public override void PlayAction(int uniqueID) { if (charToAnim != null) { charToAnim.ChangeCharacterState(newState); SendOverStatusToPlayer(uniqueID); } else { SendOverStatusToPlayer(uniqueID); } }
public override void PlayAction(int uniqueID) { if (charToMove != null) { MoveToDestination existentScript = charToMove.GetComponent <MoveToDestination> (); if (existentScript == null) { CharacterController charCont = charToMove.GetComponent <CharacterController> (); SnapToGround snap = charToMove.GetComponent <SnapToGround> (); if (ignoreCollisions) { if (snap != null && snap.enabled) { snap.enabled = false; } } else { if (charCont == null) { charToMove.gameObject.AddComponent <CharacterController> (); } if (snap == null) { charToMove.gameObject.AddComponent <SnapToGround> (); } if (!snap.enabled) { snap.enabled = true; } } if (moveSpeed == MoveSpeed.Teleport) { Debug.Log("TELEPORTING"); charToMove.transform.position = destination.position; SendOverStatusToPlayer(uniqueID); } else { if (ignoreCollisions) { if (snap != null) { snap.enabled = false; } } MoveToDestination script = charToMove.gameObject.AddComponent <MoveToDestination> (); script.UniqueID = uniqueID; script.Script = this; script.Destination = destination.position; script.Speed = moveSpeed == MoveSpeed.Walk ? ControllableCharacter.DEFAULT_WALKING_SPEED : moveSpeed == MoveSpeed.Run ? Run.DEFAULT_RUNNING_SPEED : customSpeed; script.IgnoreCollisions = ignoreCollisions; script.IgnoreHeightPosition = ignoreHeightPosition; if (charAnimator != null) { if (useMoveSpeedAnimation) { charAnimator.UpdateCharacterParams((destination.position - charToMove.transform.position).normalized, true, moveSpeed == MoveSpeed.Run || moveSpeed == MoveSpeed.Custom && customSpeed >= Run.DEFAULT_RUNNING_SPEED); } else { charAnimator.ChangeCharacterState(anim); } } } } else { SendOverStatusToPlayer(uniqueID); } } else { SendOverStatusToPlayer(uniqueID); } }