Beispiel #1
0
    void AddPickup(Player player, PickupManager.PickupType pickupType)
    {
        switch (pickupType)
        {
        case PickupManager.PickupType.ExtraBomb:
        {
            UpdateBombCounter(player, 1);
            player.BombCountText.text = string.Format("BombCount : {0}", player.CurrentBombCount);
        } break;

        case PickupManager.PickupType.LongerBlast:
        {
            player.BombStrength = Mathf.Min(player.BombStrength + 1, MaxBombStrength);
        } break;

        case PickupManager.PickupType.BootsOfSpeed:
        {
            player.Speed          = Mathf.Min(player.Speed + 1, PlayerMaxSpeed);
            player.SpeedText.text = string.Format("Speed : {0}", player.Speed);
        } break;

        case PickupManager.PickupType.RemoteBomb:
        {
            player.RemoteControlTimer += 10.0f;
            player.RemoteBombText.text = string.Format(RemoteBombTextFormat, player.RemoteControlTimer);
        } break;
        }
    }
Beispiel #2
0
    void ProcessIndex(Player player)
    {
        Vector3 position = player.PlayerT.position;

        position.x += startX;
        position.z -= startZ;

        player.Column = (int)Mathf.Floor(Mathf.Abs(position.x) + 0.5f);
        player.Row    = (int)Mathf.Floor(Mathf.Abs(position.z) + 0.5f);
        int index = GetIndex(player.Row, player.Column);

        if (index >= 0 && index < CurrentLevelData.LevelMap.Length)
        {
            int mapData = CurrentLevelData.LevelMap[index];
            if (mapData == (int)LevelData.ElementType.Pickups)
            {
                PickupManager.PickupType pickupType = PickupManager.RemoveAndGetPickupType(index);
                CurrentLevelData.LevelMap[index] = 0;
                AddPickup(player, pickupType);
            }
        }
    }