Exemplo n.º 1
0
 protected void FixedUpdate()
 {
     if (this.CharacterController.enabled)
     {
         if (this.AttachedCharacter.Velocity == Vector3.zero)
         {
             this.AttachedCharacter.RunAccelerationTimer.reset();
         }
         this.AttachedCharacter.RunAccelerationTimer.tick(Time.fixedDeltaTime * Time.timeScale);
         if (ConfigGameplay.OUT_OF_BOUNDS_CHECKING_ENABLED && (Time.fixedTime >= this.m_nextOutOfBoundsCheck))
         {
             ActiveDungeon activeDungeon = GameLogic.Binder.GameState.ActiveDungeon;
             if (((activeDungeon != null) && (activeDungeon.ActiveRoom != null)) && (activeDungeon.CurrentGameplayState == GameplayState.ACTION))
             {
                 Room activeRoom = activeDungeon.ActiveRoom;
                 if (!PhysicsUtil.IsOnSurface(this.Transform.position + ((Vector3)(Vector3.up * 0.5f)), float.MaxValue, Layers.GroundLayerMask))
                 {
                     Vector3 worldPt = activeRoom.adjustToNearestGridPoint(this.Transform.position);
                     Vector3 vector2 = activeRoom.calculateNearestEmptySpot(worldPt, Vector3.zero, 1f, 1f, 6f, null);
                     this.Transform.position = vector2;
                 }
                 this.m_nextOutOfBoundsCheck = Time.fixedTime + (0.5f * UnityEngine.Random.Range((float)1f, (float)2f));
             }
         }
     }
 }
Exemplo n.º 2
0
        public CharacterInstance getClosestEnemyCharacterWithHighestLife(Vector3 worldPt, CharacterInstance referenceCharacter, bool lineOfSight, float withinRadius)
        {
            CharacterInstance instance = null;
            double            minValue = double.MinValue;
            float             maxValue = float.MaxValue;

            for (int i = 0; i < this.ActiveCharacters.Count; i++)
            {
                CharacterInstance another = this.ActiveCharacters[i];
                if (((((another != referenceCharacter) && !another.IsDead) && !referenceCharacter.isFriendlyTowards(another)) && !another.isInvisible()) && (!lineOfSight || this.lineOfSightCharacterToCharacter(referenceCharacter, another)))
                {
                    float num4 = PhysicsUtil.DistBetween(referenceCharacter, another);
                    if ((num4 <= withinRadius) && ((another.MaxLife(true) > minValue) || ((another.MaxLife(true) == minValue) && (num4 < maxValue))))
                    {
                        instance = another;
                        minValue = another.MaxLife(true);
                        maxValue = num4;
                    }
                }
            }
            return(instance);
        }
Exemplo n.º 3
0
 private void onCharacterTargetUpdated(CharacterInstance character, CharacterInstance oldTarget)
 {
     if (((character == GameLogic.Binder.GameState.ActiveDungeon.PrimaryPlayerCharacter) && (character.TargetCharacter != null)) && ((character.CurrentHp < character.MaxLife(true)) && (PhysicsUtil.DistBetween(character, character.TargetCharacter) > ConfigGameplay.PASSIVE_HP_REGEN_PROXIMITY_THRESHOLD)))
     {
         this.m_hpRegenNextTick[character] = Time.fixedTime + ConfigGameplay.PASSIVE_HP_REGEN_TICK_INTERVAL;
     }
 }