Exemplo n.º 1
0
    private void UpdatePhaseGauge()
    {
        if (AscensionLevel == default(ModifiableStat) ||
            AscensionRate == default(ModifiableStat) ||
            AscensionLockoutRate == default(ModifiableStat))
        {
            FormattedDebugMessage(LogLevel.Info, "There is no AscensionLevel, AscensionRate, or AscensionLockoutRate stat tied to Player {0}", gameObject.name);
            return;
        }

        if (AscensionLockout.LockoutRate != AscensionLockoutRate.Value)
        {
            AscensionLockout.LockoutRate = AscensionLockoutRate.Value;
        }

        if (!AscensionLockout.CanAttempt())
        {
            return;
        }

        AscensionLevel.Alter(AscensionRate.ModifiedValue);
        if (AscensionLevel.Value > AscensionLevel.ValueCap)
        {
            AscensionLevel.Value = AscensionLevel.ValueCap;
        }
        else if (AscensionLevel.Value < 0)
        {
            AscensionLevel.Value = 0;
        }

        GameUIController.UpdatePhoenixGauge(AscensionLevel.Value, AscensionLevel.ValueCap);
        AscensionLockout.NoteLastOccurrence();

        CheckForPhaseChange();
    }
Exemplo n.º 2
0
    public void SpawnRevivable()
    {
        if (!SpawnLockout.CanAttempt())
        {
            return;
        }

        int    modelId   = Random.Range(0, RevivableModels.Count);
        string modelName = RevivableModels[modelId];

        int  spawnAttempts = 0;
        bool pointSelected = false;

        do
        {
            int        pointId    = Random.Range(0, SpawnPoints.Count);
            GameObject spawnPoint = SpawnPoints[pointId];

            bool isOccupied = IsSpawnPointOccupied(spawnPoint);
            if (!isOccupied)
            {
                pointSelected = true;
                MatchEntityManager.SpawnRevivable(spawnPoint.transform.position, spawnPoint.transform.rotation, modelName);
            }
            else
            {
                spawnAttempts++;
            }
        } while (!pointSelected && spawnAttempts < 5);

        SpawnLockout.NoteLastOccurrence();
    }
    private void EvaluateAttentionSpan()
    {
        if (AttentionSpan == default(ModifiableStat) ||
            AttentionSpanDecay == default(ModifiableStat) ||
            AttentionSpanDecayRate == default(ModifiableStat))
        {
            FormattedDebugMessage(LogLevel.Info, "There is no AttentionSpan, AttentionSpanDecay, or AttentionSpanDecayRate stat tied to AI {0}", gameObject.name);
            return;
        }

        AttentionSpanDecayLockout.LockoutRate = AttentionSpanDecayRate.Value;
        if (!AttentionSpanDecayLockout.CanAttempt())
        {
            return;
        }

        if (AttentionSpan.Value <= 0.0f)
        {
            Destroy(gameObject);
        }

        AttentionSpan.Value -= AttentionSpanDecay.Value;
        FormattedDebugMessage(LogLevel.Info, "AI entity {0}'s attention level is now {1}", gameObject.name, AttentionSpan.Value);
        AttentionSpanDecayLockout.NoteLastOccurrence();
    }
Exemplo n.º 4
0
    public void Update()
    {
        if (!IsOpen)
        {
            return;
        }

        if (DoorLockout.CanAttempt())
        {
            StartCoroutine(CloseDoor());
        }
    }
Exemplo n.º 5
0
    public void DetectEntities()
    {
        if (!DetectionLockout.CanAttempt())
        {
            return;
        }

        Collider[] hitColliders = Physics.OverlapSphere(transform.position, Radius);
        PriorEntityCount = SensedEntities.Count;
        SensedEntities   = GetInterestingObjects(hitColliders, AffectedTags);

        DetectionLockout.NoteLastOccurrence();
    }
Exemplo n.º 6
0
    public void Fire()
    {
        if (!CanFire)
        {
            return;
        }

        if (!WeaponLockout.CanAttempt())
        {
            return;
        }

        FireProjectile();
        WeaponLockout.NoteLastOccurrence();
    }
    private void GetInput()
    {
        CheckWeaponFire();

        float walkAmount   = _controls.GetAxis(WalkAxis);
        float strafeAmount = _controls.GetAxis(StrafeAxis);

        PlanarMotion = new Vector3(strafeAmount, 0, walkAmount);
        _movement.ProcessPlanarMovement(PlanarMotion);

        bool jumpPressed  = _controls.GetAxisDown(JumpAxis);
        bool jumpHeld     = (_controls.GetAxis(JumpAxis) > 0.0f) && !jumpPressed;
        bool jumpReleased = _controls.GetAxisUp(JumpAxis);

        if (jumpPressed &&
            !_movement.IsJumping &&
            JumpCount > 0 &&
            JumpLockout.CanAttempt())
        {
            _movement.PerformJump();
            JumpCount--;
            JumpLockout.NoteLastOccurrence();
        }

        if (jumpHeld && _movement.IsJumping)
        {
            _movement.PerformJump();
        }

        if (jumpReleased && _movement.IsJumping)
        {
            _movement.AbortJump();
        }

        //result = PlayerActionStates.Idle;

        //if (walkAmount > 0)
        //    result = PlayerActionStates.Walk;
        //else if (walkAmount < 0)
        //    result = PlayerActionStates.Backstep;

        //if (strafeAmount > 0)
        //    result = PlayerActionStates.StrafeRight;
        //else if (strafeAmount < 0)
        //    result = PlayerActionStates.StrafeLeft;
    }
    private void CheckForReviveProximity()
    {
        if (!ReviveUpdateLockout.CanAttempt())
        {
            return;
        }

        ReviveUpdateLockout.NoteLastOccurrence();
        RevivableSensor.DetectEntities();

        // If nothing has been sensed, do nothing else.
        // If nothing has been sensed, but something is no longer detected, hide the Revive guage.
        if (RevivableSensor.HasSensedNothing)
        {
            if (RevivableSensor.HasLeft)
            {
                DebugMessage("An object that can revive has left the sensor, and nothing else that can is nearby.");
                GameUIController.ShowRevivingGauge(false);
            }

            return;
        }

        // If something has just been sensed, show the revive guage.
        if (RevivableSensor.HasEntered)
        {
            GameUIController.ShowRevivingGauge(true);
        }

        // If something is being sensed, increment the gauge
        ReviveStatus.Increase(ReviveRate.Value);
        FormattedDebugMessage(LogLevel.Info, "Reviving {0}: {1}/{2}", gameObject.name, ReviveStatus.Value, ReviveStatus.ValueCap);
        GameUIController.UpdateRevivingGauge(ReviveStatus.Value, ReviveStatus.ValueCap);

        // If the revive is complete, hide the gauge, spawn the revived object.
        if (ReviveStatus.IsAtMax)
        {
            FormattedDebugMessage(LogLevel.Info, "Reviving {0} as {1}", gameObject.name, ReviveModelName);

            gameObject.SetActive(false);
            GameUIController.ShowRevivingGauge(false);
            ScoreManager.NoteChickenRescue();

            MatchEntityManager.SpawnMob(transform.position, transform.rotation, ReviveModelName);
        }
    }
Exemplo n.º 9
0
    public void OnTriggerStay(Collider who)
    {
        // If not periodic, don't even bother.
        if (Mathf.Abs(PeriodicDamageLockout.LockoutRate - 0.0f) <= 0.001f)
        {
            return;
        }

        if (!AffectedTags.Contains(who.tag))
        {
            return;
        }

        if (!PeriodicDamageLockout.CanAttempt())
        {
            return;
        }

        DealDamage(who.gameObject);
        PeriodicDamageLockout.NoteLastOccurrence();
    }