// Token: 0x060001CA RID: 458 RVA: 0x00017D70 File Offset: 0x00015F70
        public void ActAttack()
        {
            bool flag = this.LastActionTime + 500.0 < (double)Main.NowGameTime;

            if (flag)
            {
                bool flag2 = !this.CTool.Owner.LockedeA;
                if (flag2)
                {
                    foreach (ePAnimation eA in this.CTool.Owner.CurrentAnimations)
                    {
                        eA.Reset();
                    }

                    this.CTool.Owner.Revert();
                    this.CTool.Use(PhysicsFuncs.RandomOf <Tool.Action>(new Tool.Action[]
                    {
                        Tool.Action.PrimaryAttack1,
                        Tool.Action.PrimaryAttack2,
                        Tool.Action.ShortAttack
                    }));
                    this.LastActionTime = (double)Main.NowGameTime;
                }
            }
        }
        // Token: 0x060001CE RID: 462 RVA: 0x0001808C File Offset: 0x0001628C
        public void ActArrowThrow()
        {
            bool flag = checked (this.ArrowLastTime + 100L) < Main.NowGameTime;

            if (flag)
            {
                Arrow Ar = new Arrow(EntityTypes.Arrow1)
                {
                    Position = this.Position + this.Height
                };
                Ar.ModelRotation      = PhysicsFuncs.CreateLookAtPosition(Ar.Position, Ar.Position + this.FacingDirection, this.HeadRotation.Up);
                Ar.Velocity           = this.HeadRotation.Forward * 5f;
                Ar.CollitionHierarchy = eCollitionHierarchy.CreateNewHierarchyForArrow(Ar);
                Ar.AddToTheCurrentStack();
                this.ArrowLastTime = Main.NowGameTime;
            }
        }
        // Token: 0x0600008F RID: 143 RVA: 0x000083D8 File Offset: 0x000065D8
        public void Go(Vector3 Destination)
        {
            this.NoTarget = false;
            Action <Entity> OriginalAI = this.DelUpdateAI;

            this.DelUpdateAI = (Action <Entity>)AIs.Worker;
            PhysicsFuncs.LookAtPosition(this, Destination);
            while (this.NeededBodyRotationChanged)
            {
                Main.Delay(10);
            }
            double LastDistance   = double.MaxValue;
            double CurrDist       = double.MaxValue;
            int    AccelerationSq = 2500;

            for (; ;)
            {
                bool flag = CurrDist < (double)AccelerationSq;
                if (flag)
                {
                    break;
                }
                long LastUpdateCount = Main.CurrUpdateCount;
                this.Go(Actions.Forward);
                while (LastUpdateCount == Main.CurrUpdateCount)
                {
                    Main.Delay(10);
                }
                CurrDist = (double)Vector3.DistanceSquared(this.Position, Destination);
                bool flag2 = CurrDist > LastDistance;
                if (flag2)
                {
                    PhysicsFuncs.LookAtPosition(this, Destination);
                    while (this.NeededBodyRotationChanged)
                    {
                        Main.Delay(10);
                    }
                }
                LastDistance = CurrDist;
            }
            this.NoTarget    = true;
            this.DelUpdateAI = OriginalAI;
        }
        // Token: 0x0600007D RID: 125 RVA: 0x000078BC File Offset: 0x00005ABC
        public virtual void DoCurrentActions()
        {
            foreach (Actions Act in this.CurrActionLst)
            {
                bool flag = Controls.Go(this, Act);
                if (flag)
                {
                    bool inRandomMovement = this.InRandomMovement;
                    if (inRandomMovement)
                    {
                        this.PickNewRandomMovement();
                    }
                }
            }

            bool flag2 = this.CurrActionLst.Contains(Actions.Attack);

            if (flag2)
            {
                bool flag3 = this.CTool != null;
                if (flag3)
                {
                    bool flag4 = this.LastActionTime + 500.0 < (double)Main.NowGameTime & !this.CTool.Owner.LockedeA;
                    if (flag4)
                    {
                        foreach (ePAnimation eA in this.CTool.Owner.CurrentAnimations)
                        {
                            eA.Reset();
                        }
                        this.CTool.Owner.Revert();
                        this.CTool.Use(PhysicsFuncs.RandomOf <Tool.Action>(new Tool.Action[]
                        {
                            Tool.Action.PrimaryAttack1,
                            Tool.Action.PrimaryAttack2,
                            Tool.Action.ShortAttack
                        }));
                        this.LastActionTime = (double)Main.NowGameTime;
                    }
                }
            }
            this.CurrActionLst.Clear();
        }
Beispiel #5
0
        // Token: 0x0600001B RID: 27 RVA: 0x00002BB0 File Offset: 0x00000DB0
        private static void DoCurrentAITartgetMode_DoNotPickNewRndMotion(Human E)
        {
            switch (E.TargetMode)
            {
            case AITargetMode.FollowAndKill:
            {
                PhysicsFuncs.LookAtEntity(E, E.Target);
                float TargetDistace = Vector3.Distance(E.Target.Position, E.Position);
                bool  flag          = E.CTool != null;
                if (flag)
                {
                    bool flag2 = TargetDistace > E.CTool.MaxAttackingDistance;
                    if (flag2)
                    {
                        PhysicsFuncs.LookAtEntity(E, E.Target);
                        E.CurrActionLst.Add(Actions.Forward);
                    }
                    else
                    {
                        bool flag3 = TargetDistace < E.CTool.MinAttackingDistance;
                        if (flag3)
                        {
                            PhysicsFuncs.LookAtEntity(E, E.Target);
                            E.CurrActionLst.Add(Actions.Backward);
                        }
                        else
                        {
                            E.CurrActionLst.Add(Actions.Attack);
                        }
                    }
                }
                break;
            }

            case AITargetMode.FollowAndAttackOnce:
            {
                PhysicsFuncs.LookAtEntity(E, E.Target);
                float TargetDistace2 = Vector3.Distance(E.Target.Position, E.Position);
                bool  flag4          = E.CTool != null;
                if (flag4)
                {
                    bool flag5 = TargetDistace2 > E.CTool.MaxAttackingDistance;
                    if (flag5)
                    {
                        PhysicsFuncs.LookAtEntity(E, E.Target);
                        E.CurrActionLst.Add(Actions.Forward);
                    }
                    else
                    {
                        bool flag6 = TargetDistace2 < E.CTool.MinAttackingDistance;
                        if (flag6)
                        {
                            PhysicsFuncs.LookAtEntity(E, E.Target);
                            E.CurrActionLst.Add(Actions.Backward);
                        }
                        else
                        {
                            E.CurrActionLst.Add(Actions.Attack);
                            E.ReleaseTartget(false);
                        }
                    }
                }
                break;
            }

            case AITargetMode.Follow:
            {
                PhysicsFuncs.LookAtEntity(E, E.Target);
                float TargetDistace3 = Vector3.Distance(E.Target.Position, E.Position);
                bool  flag7          = TargetDistace3 > E.eType.Width + 100f;
                if (flag7)
                {
                    PhysicsFuncs.LookAtEntity(E, E.Target);
                    E.CurrActionLst.Add(Actions.Forward);
                }
                else
                {
                    bool flag8 = TargetDistace3 < E.eType.Width;
                    if (flag8)
                    {
                        PhysicsFuncs.LookAtEntity(E, E.Target);
                        E.CurrActionLst.Add(Actions.Backward);
                    }
                }
                break;
            }

            case AITargetMode.Look:
                PhysicsFuncs.LookAtEntity(E, E.Target);
                break;

            case AITargetMode.RunFromIt:
                PhysicsFuncs.LookOutFromEntity(E, E.Target);
                E.CurrActionLst.Add(Actions.Forward);
                break;
            }
        }
Beispiel #6
0
        // Token: 0x0600001A RID: 26 RVA: 0x000028C0 File Offset: 0x00000AC0
        private static void DoCurrentAITartgetMode(Human E)
        {
            checked
            {
                switch (E.TargetMode)
                {
                case AITargetMode.None:
                {
                    E.CRandomMovementTime++;
                    bool flag = E.CRandomMovementTime > E.InRandomMovementTime;
                    if (flag)
                    {
                        E.PickNewRandomMovement();
                    }
                    break;
                }

                case AITargetMode.FollowAndKill:
                {
                    PhysicsFuncs.LookAtEntity(E, E.Target);
                    float TargetDistace = Vector3.Distance(E.Target.Position, E.Position);
                    bool  flag2         = E.CTool != null;
                    if (flag2)
                    {
                        bool flag3 = TargetDistace > E.CTool.MaxAttackingDistance;
                        if (flag3)
                        {
                            PhysicsFuncs.LookAtEntity(E, E.Target);
                            E.CurrActionLst.Add(Actions.Forward);
                        }
                        else
                        {
                            bool flag4 = TargetDistace < E.CTool.MinAttackingDistance;
                            if (flag4)
                            {
                                PhysicsFuncs.LookAtEntity(E, E.Target);
                                E.CurrActionLst.Add(Actions.Backward);
                            }
                            else
                            {
                                E.CurrActionLst.Add(Actions.Attack);
                            }
                        }
                    }
                    break;
                }

                case AITargetMode.FollowAndAttackOnce:
                {
                    PhysicsFuncs.LookAtEntity(E, E.Target);
                    float TargetDistace2 = Vector3.Distance(E.Target.Position, E.Position);
                    bool  flag5          = E.CTool != null;
                    if (flag5)
                    {
                        bool flag6 = TargetDistace2 > E.CTool.MaxAttackingDistance;
                        if (flag6)
                        {
                            PhysicsFuncs.LookAtEntity(E, E.Target);
                            E.CurrActionLst.Add(Actions.Forward);
                        }
                        else
                        {
                            bool flag7 = TargetDistace2 < E.CTool.MinAttackingDistance;
                            if (flag7)
                            {
                                PhysicsFuncs.LookAtEntity(E, E.Target);
                                E.CurrActionLst.Add(Actions.Backward);
                            }
                            else
                            {
                                E.CurrActionLst.Add(Actions.Attack);
                                E.ReleaseTartget(true);
                            }
                        }
                    }
                    break;
                }

                case AITargetMode.Follow:
                {
                    PhysicsFuncs.LookAtEntity(E, E.Target);
                    float TargetDistace3 = Vector3.Distance(E.Target.Position, E.Position);
                    bool  flag8          = TargetDistace3 > unchecked (E.eType.Width + 100f);
                    if (flag8)
                    {
                        PhysicsFuncs.LookAtEntity(E, E.Target);
                        E.CurrActionLst.Add(Actions.Forward);
                    }
                    else
                    {
                        bool flag9 = TargetDistace3 < E.eType.Width;
                        if (flag9)
                        {
                            PhysicsFuncs.LookAtEntity(E, E.Target);
                            E.CurrActionLst.Add(Actions.Backward);
                        }
                    }
                    break;
                }

                case AITargetMode.Look:
                {
                    PhysicsFuncs.LookAtEntity(E, E.Target);
                    E.CRandomMovementTime++;
                    bool flag10 = E.CRandomMovementTime > E.eType.LookingAtTimeout;
                    if (flag10)
                    {
                        E.PickNewRandomMovement();
                    }
                    break;
                }

                case AITargetMode.RunFromIt:
                {
                    PhysicsFuncs.LookOutFromEntity(E, E.Target);
                    E.CurrActionLst.Add(Actions.Forward);
                    E.CRandomMovementTime++;
                    bool flag11 = E.CRandomMovementTime > E.InRandomMovementTime;
                    if (flag11)
                    {
                        E.PickNewRandomMovement();
                    }
                    break;
                }
                }
            }
        }