コード例 #1
0
 private void AddToPlayer(CollectableActionScript collectableAction)
 {
     if (collectableAction != null)
     {
         collectableAction._collectedTypes.Add(CurrentCollectableType);
     }
 }
コード例 #2
0
    private void CheckPlayer(GameObject player)
    {
        CollectableActionScript collectableAction = player.GetComponent <CollectableActionScript>();

        if (collectableAction != null)
        {
            DetermineDestiny(player, collectableAction);
        }
    }
コード例 #3
0
    private void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "Player" && this.enabled)
        {
            this.enabled                = false;
            _renderer.enabled           = false;
            _rigidbody.detectCollisions = false;
            _rigidbody.isKinematic      = false;

            CollectableActionScript collectableAction = collision.gameObject.GetComponent <CollectableActionScript>();
            AddToPlayer(collectableAction);
        }
    }
コード例 #4
0
    public void DetermineIfGoalReached(GameObject gameObject)
    {
        CollectableActionScript actionScript = GetComponent <CollectableActionScript>();

        if (actionScript != null && actionScript.IsCarryingKey)
        {
            // TODO: Go to next scene?
            StartCoroutine(PauseBeforeMovingToNextLevel());
        }
        else
        {
            _movementDirection = -_movementDirection;
        }
    }
コード例 #5
0
 private void DetermineDestiny(GameObject player, CollectableActionScript collectableAction)
 {
     if (collectableAction.CurrentCrabStatus == CollectableActionScript.CrabStatus.Invincible)
     {
         DestroyEnemy(player);
     }
     else
     {
         ShowCutscene();
         //TODO: Display cutscene, then place crab back at original point
         CrabMovementScript script = player.GetComponent <CrabMovementScript>();
         if (script != null)
         {
             script.PlaceInOriginalPosition();
         }
     }
 }
コード例 #6
0
    private void DestroyEnemy(GameObject player)
    {
        _rigidbody.isKinematic      = false;
        _rigidbody.detectCollisions = false;

        CollectableActionScript action = player.GetComponent <CollectableActionScript>();

        action._collectedTypes.Add(CollectableBehaviorScript.CollectableType.Jam);
        action.IsCarryingKey = true;

        CrabMovementScript movementScript = player.GetComponent <CrabMovementScript>();

        movementScript.PauseMovementDuringSecond(_animationTime);

        StartCoroutine(ExecuteAnimation());

        _jarIcon.SetActive(true);
    }