Skip to content

Commit

Permalink
feature/#1 コンフリクト修正
Browse files Browse the repository at this point in the history
  • Loading branch information
satwu-0 committed Jun 15, 2024
2 parents a9a9cc0 + 4f1e47b commit a3dd845
Show file tree
Hide file tree
Showing 1,677 changed files with 194,711 additions and 67 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Assets/DownLoadAssets/Zenject/Source/Zenject.csproj.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
93 changes: 93 additions & 0 deletions Assets/MyAssets/Common/Scripts/PlayFabTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using PlayFab;
using PlayFab.ClientModels;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class PlayFabTest : MonoBehaviour
{
public static Dictionary<string, string> SaveDatas = new Dictionary<string, string>();
public static Dictionary<string, string> DecodingDatas = new Dictionary<string, string>();

public void Login()
{
if (string.IsNullOrEmpty(PlayFabSettings.staticSettings.TitleId))
{
/*
Please change the titleId below to your own titleId from PlayFab Game Manager.
If you have already set the value in the Editor Extensions, this can be skipped.
*/
PlayFabSettings.staticSettings.TitleId = "235DD";
}
SaveCustomId();
var request = new LoginWithCustomIDRequest { CustomId = CustomId, CreateAccount = true };
PlayFabClientAPI.LoginWithCustomID(request, OnLoginSuccess, OnLoginFailure);
}

const string PLAYFAB_CUSTOM_ID = "PLAYFAB_CUSTOM_ID";
public static string CustomId { get => PlayerPrefs.GetString(PLAYFAB_CUSTOM_ID, Guid.NewGuid().ToString()); }

public void SaveCustomId()
{
PlayerPrefs.SetString(PLAYFAB_CUSTOM_ID, CustomId);
PlayerPrefs.Save();
}

private void OnLoginSuccess(LoginResult result)
{
Debug.Log("PlayFab : Connected");
GetUserData(result.PlayFabId);

}

private void OnLoginFailure(PlayFabError error)
{
Debug.LogWarning("PlayFab : Login Error");
Debug.LogError(error.GenerateErrorReport());
}

void SetUserData()
{
PlayFabClientAPI.UpdateUserData(new UpdateUserDataRequest()
{
Data = new Dictionary<string, string>() {
{"positionX", transform.position.x.ToString("G9")},
{"positionY", transform.position.y.ToString("G9")},
{"positionZ", transform.position.z.ToString("G9")}
}
},
result => Debug.Log("PlayFab : Successfully updated user data"),
error => {
Debug.Log("PlayFab : Got error setting user data Ancestor to Arthur");
Debug.Log(error.GenerateErrorReport());
});
}

Dictionary<string,UserDataRecord> GetUserData(string myPlayFabId)
{
Dictionary<string, UserDataRecord> returnData = null;
PlayFabClientAPI.GetUserData(new GetUserDataRequest()
{
PlayFabId = myPlayFabId,
Keys = null
}, result => {
Debug.Log("PlayFab : Got user data");
foreach (var entry in result.Data)
{
Debug.Log(" " + entry.Key + ": " + entry.Value.Value);
}
if (result.Data == null || !result.Data.ContainsKey("positionX") || !result.Data.ContainsKey("positionY") || !result.Data.ContainsKey("positionZ")) Debug.Log("No data");
else
{
Vector3 pos = new Vector3(float.Parse(result.Data["positionX"].Value), float.Parse(result.Data["positionY"].Value), float.Parse(result.Data["positionZ"].Value));
transform.position = pos;
}
returnData = result.Data;
}, (error) => {
Debug.Log("PlayFab : Got error retrieving user data");
Debug.Log(error.GenerateErrorReport());
});
return returnData;
}
}
2 changes: 2 additions & 0 deletions Assets/MyAssets/Common/Scripts/PlayFabTest.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
93 changes: 93 additions & 0 deletions Assets/MyAssets/Develops/Aizaki/Scripts/AddForce.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class AddForce : MonoBehaviour
{
List<Rigidbody2D> rigidbody2Ds;
List<Transform> transforms;

[SerializeField] GameObject eye;

// Start is called before the first frame update
void Start()
{
rigidbody2Ds = gameObject.GetComponentsInChildrenWithoutSelf<Rigidbody2D>().ToList();
transforms = gameObject.GetComponentsInChildrenWithoutSelf<Transform>().ToList();
}

float time;
Vector2 cursorWorldPos;
Vector3 eyePos;

// Update is called once per frame
void Update()
{

if (Input.GetMouseButtonDown(0))
{
cursorWorldPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
Move(cursorWorldPos, 20f, 10, ForceMode2D.Impulse);
}

if (Input.GetKeyDown(KeyCode.W))
{
Move((Vector2)transform.position + new Vector2(0, 10), 10f, 10, ForceMode2D.Impulse);
}
if (Input.GetKey(KeyCode.A))
{
Move((Vector2)transform.position + new Vector2(-5, 0), 10f, 12);
}
if (Input.GetKey(KeyCode.S))
{
Move((Vector2)transform.position + new Vector2(0, -5), 10f, 12);
}
if (Input.GetKey(KeyCode.D))
{
Move((Vector2)transform.position + new Vector2(5, 0), 10f, 12);
}

/*
eyePos.x = transforms.Average(x => x.position.x);
eyePos.y = transforms.Average(x => x.position.y);
eye.transform.position = eyePos;
*/
}

void Move(Vector2 destination, float multiplier)
{
Move(destination, multiplier, 3, ForceMode2D.Force);
}

void Move(Vector2 destination, float multiplier, int count)
{
Move(destination, multiplier, count, ForceMode2D.Force);
}

void Move(Vector2 destination, float multiplier, int count, ForceMode2D forceMode)
{
switch (forceMode)
{
case ForceMode2D.Force:
rigidbody2Ds.OrderBy(x => (destination - (Vector2)x.transform.position).sqrMagnitude).Take(count).ToList().ForEach(x => x.AddForce((destination - (Vector2)transform.position).normalized * multiplier, forceMode));
break;
case ForceMode2D.Impulse:
rigidbody2Ds.OrderBy(x => (destination - (Vector2)x.transform.position).sqrMagnitude).Take(count).ToList().ForEach(x => x.AddForce((destination - (Vector2)transform.position).normalized * multiplier, forceMode));
break;
default:
break;
}
}
}

public static class GameObjectExtensions
{
public static T[] GetComponentsInChildrenWithoutSelf<T>(this GameObject self, bool includeInactive = false) where T : Component
{
return self
.GetComponentsInChildren<T>(includeInactive)
.Where(c => self != c.gameObject)
.ToArray();
}
}
11 changes: 11 additions & 0 deletions Assets/MyAssets/Develops/Aizaki/Scripts/AddForce.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions Assets/MyAssets/Develops/Aizaki/Scripts/Stickey.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Stickey : MonoBehaviour
{
[SerializeField]
SpringJoint2D spring;
LineRenderer lineRenderer;

bool isSticking = false;

Vector3[] lerps;

[SerializeField, Range(0, 1)]
float viscosity = 0.5f;



// Start is called before the first frame update
void Start()
{
lineRenderer = gameObject.GetComponent<LineRenderer>();
lineRenderer.positionCount = 5;
lineRenderer.widthMultiplier = UnityEngine.Random.Range(0.15f,0.65f);
lerps = new Vector3[5];
Init();
}

void Init()
{
spring.breakForce = 200 * viscosity;
spring.frequency = 100 / (viscosity * 100 + 1);
}

// Update is called once per frame
void Update()
{
if (isSticking)
{
lineRenderer.enabled = true;
lerps = new Vector3[5];
Vector3 pos = transform.position;
Vector3 connectedPos = spring.connectedBody.transform.TransformPoint(spring.connectedAnchor);
for (int i = 0; i < 5; i++)
{
lerps[i] = Vector3.LerpUnclamped(pos, connectedPos, i * 0.28f);
}
lineRenderer.SetPositions(lerps);
}
else
{
lineRenderer.enabled = false;
}
}

private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.tag == "SlimeController") return;
spring.connectedBody = collision.rigidbody;
spring.enabled = true;
spring.connectedAnchor = collision.gameObject.transform.InverseTransformPoint(collision.GetContact(0).point);
isSticking = true;
}

private void OnJointBreak2D(Joint2D joint)
{
if (joint == spring)
{
isSticking = false;
spring.enabled = false;
}
}
}
11 changes: 11 additions & 0 deletions Assets/MyAssets/Develops/Aizaki/Scripts/Stickey.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/MyAssets/Develops/Aizaki/Textures.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a3dd845

Please sign in to comment.