void LateUpdate() { Vector3 direction = GridMovement.GetDirectionFromInput(); if ((clone = cloneAbility.GetClone())) // intentional assignment { cloneMovement = clone.GetComponent <GridMovement> (); if (!movement.IsMoving() && !cloneMovement.IsMoving()) { movement.MoveInDirection(direction); cloneMovement.MoveInDirection(direction); } else if (cloneMovement.isOnIce && !movement.IsMoving()) { movement.MoveInDirection(direction); } else if (movement.isOnIce && !cloneMovement.IsMoving()) { cloneMovement.MoveInDirection(direction); } } else if (movement.enabled) { movement.MoveInDirection(direction); } }
void Update() { if (!isActive && Input.GetKeyDown(KeyCode.C) && !playerMovement.IsMoving()) { ActivateClone(); } else if (isActive && Input.GetKeyDown(KeyCode.C)) { DestroyCloneSpawner(); // destroy both for good measure DestroyClone(cancelled: true); playerMovement.enabled = true; } if (isActive && cloneSpawner) { TrackSpawnerDuration(); } if (isActive && clone) { TrackCloneDuration(); } if (isActive && !cloneSpawner && !clone) { isActive = false; } }
void LateUpdate() { Vector3 direction = GridMovement.GetDirectionFromInput (); if ((clone = cloneAbility.GetClone ())) { // intentional assignment cloneMovement = clone.GetComponent<GridMovement> (); if (!movement.IsMoving () && !cloneMovement.IsMoving ()) { movement.MoveInDirection (direction); cloneMovement.MoveInDirection (direction); } else if (cloneMovement.isOnIce && !movement.IsMoving ()) { movement.MoveInDirection (direction); } else if (movement.isOnIce && !cloneMovement.IsMoving ()) { cloneMovement.MoveInDirection (direction); } } else if (movement.enabled) { movement.MoveInDirection (direction); } }