private void AddToPlayer(CollectableActionScript collectableAction)
 {
     if (collectableAction != null)
     {
         collectableAction._collectedTypes.Add(CurrentCollectableType);
     }
 }
    private void CheckPlayer(GameObject player)
    {
        CollectableActionScript collectableAction = player.GetComponent <CollectableActionScript>();

        if (collectableAction != null)
        {
            DetermineDestiny(player, collectableAction);
        }
    }
    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);
        }
    }
Ejemplo n.º 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;
        }
    }
 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();
         }
     }
 }
    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);
    }