public override void Enter()
 {
     restart = false;
     currentShowDeathTime = 0;
     owner.PlayerRender.material.color = Color.black;
     BombermanSettings.OnPlayerDead(owner);
 }
Exemplo n.º 2
0
    public void Hit(BombController bomb)
    {
        if (PoweredUpTime > 0 && !BombermanSettings.GetEvno(Arena).PowerDoNothing)
        {
            return;
        }

        if (PoweredUpTime > 0)
        {
            PowerDoNothingDeath++;
        }
        else
        {
            NoPowerDeath++;
        }
        //5 Debug.Log(string.Format("Had power: {0}, total: {1}", PowerDoNothingDeath, PowerDoNothingDeath + NoPowerDeath));


        if ((StandingOnLine(transform.localPosition.x) || StandingOnLine(transform.localPosition.z)) && BombermanSettings.GetEvno(Arena).CellLineProtection)
        {
            SavedByLine++;
            //Debug.Log(string.Format("Saved: {0}, Total: {1}", SavedByLine, SavedByLine + NotSavedByLine));
            return;
        }
        else
        {
            NotSavedByLine++;
            //Debug.Log(string.Format("Saved: {0}, Total: {1}", SavedByLine, SavedByLine + NotSavedByLine));
        }

        LastKilledBy = bomb;
        StateMachine.TransitionTo <PlayerDeadState>();
    }
Exemplo n.º 3
0
    public void Step()
    {
        if (PoweredUpTime >= 0f && (PowerUpStacking < BombermanSettings.GetEvno(Arena).PowerStackingNumber&& BombermanSettings.GetEvno(Arena).PowerStacking))
        {
            PoweredUpTime -= Arena.TimeStep;
        }
        if (PoweredUpTime <= 0f)
        {
            PowerUpStacking = 0;
        }

        if (StandingOnLine(transform.localPosition.x) || StandingOnLine(transform.localPosition.z))
        {
            BombermanSettings.onLine++;
        }
        else
        {
            BombermanSettings.offLine++;
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            Debug.Log("On line: " + ((float)BombermanSettings.onLine / (float)(BombermanSettings.onLine + BombermanSettings.offLine)));
        }
    }
    private void DropBomb()
    {
        owner.CurrentBombCD = 0;
        Vector3 cellPos      = new Vector3(Mathf.RoundToInt(transform.localPosition.x), Mathf.RoundToInt(transform.localPosition.y), Mathf.RoundToInt(transform.localPosition.z));
        Vector3 cellPosWorld = owner.Arena.transform.TransformPoint(cellPos);

        if (!Physics.CheckBox(cellPos, Vector3.one / 2.1f, Quaternion.identity, KickLayer) && owner.CurrentBombAmount > 0)
        {
            if (BombermanSettings.GetEvno(_owner.Arena).PlayerColliderIgnoredOnBombDrop)
            {
                IgnoreCollisionTime = BombermanSettings.GetEvno(_owner.Arena).PlayerColliderIgnoredOnBombDropTime;
            }

            BombController bomb = Instantiate(owner.Bomb, cellPosWorld, Quaternion.identity, owner.Arena.transform).GetComponent <BombController>();
            bomb.Arena = owner.Arena;
            owner.Arena.RegisterGameObject(bomb.gameObject);
            owner.CurrentBombAmount--;
            bomb.Placer = owner;
            bomb.Owner  = owner;
            bomb.Team   = owner.Team;
            StateMachine.GetState <PlayerCooldownState>().Setup(this, DropBombCooldownTime);
            StateMachine.TransitionTo <PlayerCooldownState>();
            BombermanSettings.OnBombSpawn(bomb);
        }
    }
Exemplo n.º 5
0
 public void FixedUpdate()
 {
     if (RenderAiInputMaps)
     {
         drawCompass();
         drawNearby();
     }
     BombermanSettings.OnUpdate(this);
 }
Exemplo n.º 6
0
    private void Awake()
    {
        if (Instance != null)
        {
            Debug.LogError("Multiple Settings");
        }
        Instance = this;

        Arena[] arenas = FindObjectsOfType <Arena>();
        foreach (Arena arena in arenas)
        {
            ArenaSettings.Add(arena, Instantiate(Settings));
        }
    }
Exemplo n.º 7
0
    public void Generate()
    {
        Tiles = new GameObject[WorldSize][];
        for (int i = 0; i < WorldSize; i++)
        {
            Tiles[i] = new GameObject[WorldSize];
        }

        Clear();
        for (int x = 0; x < WorldSize; x++)
        {
            for (int y = 0; y < WorldSize; y++)
            {
                PlaceBlock(x, y, (float)WorldSize);
            }
        }

        //Boxes
        List <GameObject> objs = PlaceObjects(BombermanSettings.GetEvno(this).BugColliderBoxes ? BugBox : Box, (int)(Random.value * MaxBoxes));

        foreach (GameObject ob in objs)
        {
            ob.GetComponentInChildren <BoxController>().Arena = this;
        }

        //Bombs
        objs = PlaceObjects(Bomb, (int)(Random.value * MaxBombs));
        foreach (GameObject ob in objs)
        {
            ob.GetComponent <BombController>().Arena = this;
        }

        PlayerController play0 = PlaceObjects(Player_0, 1)[0].GetComponentInChildren <PlayerController>();

        play0.Arena = this;
        play0.gameObject.GetComponentInChildren <MeshRenderer>().material.color = TeamColors[0];
        PlayerController play1 = PlaceObjects(Player_1, 1)[0].GetComponentInChildren <PlayerController>();

        play1.Arena = this;
        play1.gameObject.GetComponentInChildren <MeshRenderer>().material.color = TeamColors[1];
        //PlacePlayers();
    }
    public void KickBomb(PlayerController owner)
    {
        Team  = owner.Team;
        Owner = owner;
        BombKickState    kick    = StateMachine.GetState <BombKickState>();
        BombExplodeState explode = StateMachine.GetState <BombExplodeState>();

        if (StateMachine.CurrentState == kick && !kick.AllowKick())
        {
            return;
        }

        if (StateMachine.CurrentState == explode && !BombermanSettings.GetEvno(Arena).JuggleBombs)
        {
            return;
        }

        kick.KickDirection = owner.AimVector.normalized;
        StateMachine.TransitionTo <BombKickState>();
        BombermanSettings.OnBombKick(this);
    }
Exemplo n.º 9
0
    public bool StandingOnLine(float d)
    {
        float x = Mathf.Abs(d - Mathf.Floor(d) - 0.5f) * 2f;

        return(x < BombermanSettings.GetEvno(Arena).CellLineProtectionSize);
    }