Esempio n. 1
0
 void OnTriggerEnter(Collider other)
 {
     if (CommonObjects.IsPlayer(other.gameObject))
     {
         PlayEndOfGameSequence();
     }
 }
Esempio n. 2
0
    void OnTriggerEnter(Collider otherCollider)
    {
        GameObject other = otherCollider.gameObject;

        //print("Collectible --> OnTriggerEnter: " + other.name);

        if (CommonObjects.IsPlayer(other))
        {
            if (!MustBePurchased || Inventory.Instance.TrySpendRupees(price))
            {
                Collect();
            }
        }
        else
        {
            if (!MustBePurchased)
            {
                Weapon_Melee w = other.GetComponent <Weapon_Melee>();
                if (w != null)
                {
                    w.OnHitCollectible(this);
                }
            }
        }
    }
Esempio n. 3
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        if (dungeonRoom.IsDoorLocked(wallDirection))
        {
            Inventory inv = CommonObjects.Player_C.Inventory;

            if (inv.HasItem("MagicKey"))
            {
                UnlockDoor();
            }
            else if (inv.HasItem("Key"))
            {
                inv.UseItem("Key");
                UnlockDoor();
            }
        }

        if (dungeonRoom.CanPassThrough(wallDirection) || PlayerIsOnOuterSideOfDoor())
        {
            SetPlayerWallCollisionEnabled(false);
        }
    }
Esempio n. 4
0
    void OnTriggerStay(Collider otherCollider)
    {
        if (!PushingEnabled)
        {
            return;
        }
        if (_isSliding || _hasFinishedSliding)
        {
            return;
        }

        GameObject other = otherCollider.gameObject;

        if (!CommonObjects.IsPlayer(other))
        {
            return;
        }
        if (requiresPowerBracelet && !Inventory.Instance.HasItem("PowerBracelet"))
        {
            return;
        }

        Player          player = CommonObjects.Player_C;
        IndexDirection2 dir    = GetPushDirection(player);

        if (!dir.IsZero())
        {
            Slide(dir);
        }
    }
Esempio n. 5
0
 void OnTriggerEnter(Collider other)
 {
     if (CommonObjects.IsPlayer(other.gameObject))
     {
         OnHitPlayer();
     }
 }
Esempio n. 6
0
    void OnTriggerEnter(Collider otherCollider)
    {
        GameObject other = otherCollider.gameObject;

        if (CommonObjects.IsPlayer(other))
        {
            TakeControlOfLink();
        }
    }
Esempio n. 7
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        subDungeon.OnPlayerEnteredPortal(this);
    }
Esempio n. 8
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        _lostSector.PlayerEnteredPortal(this);
    }
Esempio n. 9
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        Locations.Instance.WarpToOverworldDungeonEntrance();
    }
Esempio n. 10
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        // TODO: Don't use SendMessage
        SendMessageUpwards("OnRupeeTriggerWasTriggered", this, SendMessageOptions.RequireReceiver);
    }
Esempio n. 11
0
 void OnTriggerEnter(Collider other)
 {
     if (CommonObjects.IsPlayer(other.gameObject))
     {
         if (!CommonObjects.Player_C.IsAtFullHealth)
         {
             PlayRestorationSequence();
         }
     }
 }
Esempio n. 12
0
    void OnTriggerEnter(Collider otherCollider)
    {
        GameObject other = otherCollider.gameObject;

        if (!CommonObjects.IsPlayer(other))
        {
            return;
        }

        Music.Instance.PlayOverworld();
    }
Esempio n. 13
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        CommonObjects.Player_C.PlayerGroundCollisionEnabled = true;

        Locations.Instance.WarpToDungeonEntranceStairs(dungeon);
    }
Esempio n. 14
0
    void OnTriggerExit(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        if (PlayerAtTopOfStairs())
        {
            CommonObjects.Player_C.PlayerGroundCollisionEnabled = true;
        }
    }
Esempio n. 15
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        if (_isInStatueMode)
        {
            StartCoroutine("ComeAlive");
        }
    }
Esempio n. 16
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }
        if (!PlayerHasRaft || PlayerIsOnRaft)
        {
            return;
        }

        TravelToDestination();
    }
Esempio n. 17
0
    void OnTriggerEnter(Collider otherCollider)
    {
        GameObject other = otherCollider.gameObject;

        if (!CommonObjects.IsPlayer(other))
        {
            return;
        }

        if (isIllusion)
        {
            PlaySecretSound();
        }
    }
Esempio n. 18
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        CommonObjects.Player_C.PlayerGroundCollisionEnabled = false;

        if (Grotto != null)
        {
            Grotto.OnPlayerExit();
        }
    }
Esempio n. 19
0
    void OnTriggerEnter(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }
        if (Grotto == null)
        {
            return;
        }

        CommonObjects.Player_C.PlayerGroundCollisionEnabled = true;

        Grotto.OnPlayerEnter();
    }
Esempio n. 20
0
    void OnTriggerExit(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }
        if (!PlayerHasLadder)
        {
            return;
        }

        if (LadderBlock == this)
        {
            RemoveLadder();
        }
    }
Esempio n. 21
0
    void OnTriggerExit(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        if (PlayerIsOnOuterSideOfDoor())
        {
            CommonObjects.Player_C.IsInDungeonRoom = false;
        }
        else
        {
            CommonObjects.Player_C.IsInDungeonRoom = true;

            SetPlayerWallCollisionEnabled(true);
        }
    }
Esempio n. 22
0
    void OnTriggerExit(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }

        Vector3 playerPos = CommonObjects.Player_C.Position;

        if (Vector3.Distance(playerPos, dungeonRoom.Center) < ThresholdDist)
        {
            dungeonRoom.OnPlayerEnteredRoom(wallDirection);
        }
        else
        {
            dungeonRoom.onPlayerExitedRoom();
        }
    }
Esempio n. 23
0
    virtual protected bool IsPlayerInLineOfSight(float maxDistance, Vector3 direction)
    {
        if (WorldInfo.Instance.IsInDungeon)
        {
            // We ensure Enemy is in the same DungeonRoom as Player
            DungeonRoom playerDR = DungeonRoom.GetRoomForPosition(Player.Position);
            if (_enemy.DungeonRoomRef != playerDR && playerDR != null)
            {
                return(false);
            }
        }

        LayerMask  mask = Extensions.GetLayerMaskIncludingLayers(ZeldaLayers.LINK, ZeldaLayers.WALLS, ZeldaLayers.BLOCKS);
        RaycastHit hitInfo;
        bool       didHit = Physics.Raycast(transform.position, direction, out hitInfo, maxDistance, mask);

        return(didHit ? CommonObjects.IsPlayer(hitInfo.collider.gameObject) : false);
    }
Esempio n. 24
0
    void OnTriggerEnterOrStay(Collider otherCollider)
    {
        if (!CommonObjects.IsPlayer(otherCollider.gameObject))
        {
            return;
        }
        if (!PlayerHasLadder || LadderBlock != null)
        {
            return;
        }

        Player player = CommonObjects.Player_C;

        if (IsPlayerMovingTowardsThisBlock(player) && CanCross(player))
        {
            Vector3 rot = DetermineLadderRotation(player);
            LayDownLadder(rot);
        }
    }