public void InitializeFromCharacter(Character Other, bool StayInPlace = false) { SetInitialCoordinates(Other.InitialCoordinates); if (!IsRewinding) { //CoordinatesList.Add(InitialCoordinates); } MapReference = Other.MapReference; if (!StayInPlace) { Coordinates = InitialCoordinates; transform.position = MapReference.MapCoordinatesToWorldSpace(InitialCoordinates); MapReference.CharacterOnBlock(this); NumberOfGhostCreated--; } else { //PreviousCommand.Add(MovementCommand.None); } PreviousCommand.AddRange(Other.PreviousCommand); if (GhostPath) { Destroy(GhostPath.gameObject); } GhostPath = Other.GhostPath; GhostPath.SetColor(Color); }
private void OnWilt() { if (GhostPath.Count < 1) { GhostPath.Add(Vector3.zero); GhostRotation.Add(Vector3.zero); InteractionState.Add(false); } status = Player_Status.wilting; AC.SetTrigger("OnWilt"); }
public IEnumerator CollidingWithGhostHomeSelectsANewPath() { GhostPath path = ghost.GetPath(); GameObject ghostHome = goManager.GetGhostHome(); ghostHome.SetActive(true); ghost.transform.position = goManager.GetGhostHome().transform.position; yield return(new WaitForSeconds(WAIT_TIME)); Assert.AreNotSame(path, ghost.GetPath()); }
public IEnumerator CollidingWithGhostHomeResetsGhost() { GhostPath path = ghost.GetPath(); GameObject ghostHome = goManager.GetGhostHome(); ghostHome.SetActive(true); ghost.transform.position = goManager.GetGhostHome().transform.position; yield return(new WaitForSeconds(WAIT_TIME)); Assert.False(ghost.IsRunningHome()); Assert.False(ghost.IsEdible()); }
public IEnumerator SelectingANewPathSetsCurrentPathToUsedAndCurrentPathIsDifferent() { GhostPath path = ghost.GetPath(); GameObject ghostHome = goManager.GetGhostHome(); ghostHome.SetActive(true); ghost.transform.position = goManager.GetGhostHome().transform.position; yield return(new WaitForSeconds(WAIT_TIME)); Assert.True(ghost.GetPath().isUsed()); Assert.AreNotSame(path, ghost.GetPath()); }
private void Awake() { if (IsPlayer()) { SetInitialCoordinates(Coordinates); //CoordinatesList.Add(Coordinates); MapReference = FindObjectOfType <Map>(); MapReference.RegisterPlayer(this); MapReference.OnGameOver += GameOver; GameObject go = Instantiate(GhostTrailPrefab, MapReference.MapCoordinatesToWorldSpace(Coordinates), Quaternion.Euler(0, 0, 0)); GhostPath = go.GetComponent <GhostPath>(); GhostPath.SetInitialPoint(InitialCoordinates); GhostPath.SetColor(Color); GetComponentInChildren <SkinnedMeshRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On; } audioSource = GetComponent <AudioSource>(); }
public void CreateNextGhost() { if (PreviousCommand.Count >= 2) { PreviousCommand.RemoveAt(PreviousCommand.Count - 1); Character ghost = MapReference.AddGhost(this); ghost.SetColor(MaterialIndexer.GhostColors[NumberOfGhostCreated % MaterialIndexer.GhostColors.Length]); NumberOfGhostCreated++; GameObject go = Instantiate(GhostTrailPrefab, MapReference.MapCoordinatesToWorldSpace(Coordinates), Quaternion.Euler(0, 0, 0)); GhostPath = go.GetComponent <GhostPath>(); PreviousCommand.Clear(); InitialCoordinates = PreviousCoordinates; GhostPath.SetInitialPoint(InitialCoordinates); GhostPath.SetColor(Color); SoundsManager.instance.PlaySoundOneShot(SoundsManager.SoundName.ghostPop, audioSource); } }
void OnEnable() { ghostPath = (GhostPath)target; }