// Token: 0x06000FAB RID: 4011 RVA: 0x0005F690 File Offset: 0x0005D890
    public void AttackTarget()
    {
        Component component = this.Target as Component;

        if (!InstantiateUtility.IsDestroyed(component))
        {
            Vector2 force = -MoonMath.Angle.VectorFromAngle(this.m_bashAngle + 90f) * 4f;
            new Damage((!this.Sein.PlayerAbilities.BashBuff.HasAbility) ? this.Damage : this.UpgradedDamage, force, Characters.Sein.Position, DamageType.Bash, base.gameObject).DealToComponents(component.gameObject);
            EntityTargetting component2 = component.gameObject.GetComponent <EntityTargetting>();
            if (component2 && component2.Entity is Enemy)
            {
                SeinBashAttack.OnBashEnemy(component2);
            }
            if (this.Sein.PlayerAbilities.BashBuff.HasAbility)
            {
                this.BeginBashThroughEnemies();
            }
        }
    }
Beispiel #2
0
        private static string UpdateEnemyInfo(int index)
        {
            EntityTargetting attackable = Targets.Attackables[index] as EntityTargetting;
            string           enemyType  = enemyType = attackable.Entity.GetType().Name;

            if (enemyType.LastIndexOf("Enemy") >= 0)
            {
                enemyType = enemyType.Substring(0, enemyType.LastIndexOf("Enemy"));
            }
            Rigidbody rb = attackable.GetComponent <Rigidbody>();

            if (lastTargetPosition.x < -9999990)
            {
                lastTargetPosition = attackable.Position;
            }
            string info = enemyType + " (" + attackable.Position.x.ToString("0.00") + ", " + attackable.Position.y.ToString("0.00") + ") (" + ((attackable.Position.x - lastTargetPosition.x) * 60).ToString("0.00") + ", " + ((attackable.Position.y - lastTargetPosition.y) * 60).ToString("0.00") + ")";

            lastTargetPosition = attackable.Position;
            return(info);
        }
Beispiel #3
0
        private static string ClosestTargetInfo()
        {
            SeinCharacter sein = Characters.Sein;
            string        info = string.Empty;

            if (sein != null)
            {
                float minDist = float.MaxValue;
                int   index   = -1;
                for (int i = 0; i < Targets.Attackables.Count; i++)
                {
                    EntityTargetting attackable = Targets.Attackables[i] as EntityTargetting;
                    if (attackable != null && attackable.IsOnScreen && attackable.Activated)
                    {
                        float dist = Vector3.Distance(attackable.Position, sein.Position);
                        if (dist < minDist)
                        {
                            index   = i;
                            minDist = dist;
                        }
                    }
                }

                float blockMinDist = 20;
                int   blockIndex   = -1;
                for (int i = 0; i < PushPullBlock.All.Count; i++)
                {
                    PushPullBlock pushPullBlock = PushPullBlock.All[i];
                    float         dist          = Vector3.Distance(pushPullBlock.Position, sein.Position);
                    if (dist < blockMinDist)
                    {
                        blockIndex   = i;
                        blockMinDist = dist;
                    }
                }

                if (blockIndex >= 0 && index >= 0)
                {
                    if (blockMinDist < minDist)
                    {
                        info = UpdateBlockInfo(blockIndex);
                    }
                    else
                    {
                        info = UpdateEnemyInfo(index);
                    }
                }
                else if (blockIndex >= 0)
                {
                    info = UpdateBlockInfo(blockIndex);
                }
                else if (index >= 0)
                {
                    info = UpdateEnemyInfo(index);
                }
                else
                {
                    lastTargetPosition = new Vector3(-9999999, -9999999);
                }
            }
            else
            {
                lastTargetPosition = new Vector3(-9999999, -9999999);
            }
            return(info);
        }
Beispiel #4
0
        public void UpdateInput(bool initial = false)
        {
            if (SaveSlot >= 0)
            {
                SaveSlotsManager.CurrentSlotIndex = SaveSlot;
                SaveSlotsManager.BackupIndex      = -1;
            }
            if (DSave && initial && GameController.Instance != null)
            {
                GameController.Instance.CreateCheckpoint();
                GameController.Instance.SaveGameController.PerformSave();
            }
            if (Copy >= 0)
            {
                SaveSlotsManager.CopySlot(Copy, SaveSlotsManager.CurrentSlotIndex);
                SaveSlotsManager.BackupIndex = -1;
            }
            if ((DLoad || Restore) && initial && GameController.Instance != null)
            {
                GameController.Instance.SaveGameController.PerformLoad();
                if (Core.Scenes.Manager != null)
                {
                    FieldInfo fieldDelayTime = typeof(ScenesManager).GetField("m_testDelayTime", BindingFlags.NonPublic | BindingFlags.Instance);
                    fieldDelayTime.SetValue(Core.Scenes.Manager, 1f);
                }
            }
            if (BlockPos && initial && Characters.Sein != null && CharacterState.IsActive(Characters.Sein.Abilities.GrabBlock))
            {
                float minDist = 20;
                int   index   = -1;
                for (int i = 0; i < PushPullBlock.All.Count; i++)
                {
                    PushPullBlock pushPullBlock = PushPullBlock.All[i];
                    float         dist          = Vector3.Distance(pushPullBlock.Position, Characters.Sein.Position);
                    if (dist < minDist)
                    {
                        index   = i;
                        minDist = dist;
                    }
                }

                if (index >= 0)
                {
                    FieldInfo fieldTransform = typeof(PushPullBlock).GetField("m_transform", BindingFlags.NonPublic | BindingFlags.Instance);
                    Transform transform      = (Transform)fieldTransform.GetValue(PushPullBlock.All[index]);
                    transform.position = new Vector3(BlockPosX, BlockPosY);
                }
            }
            if (!string.IsNullOrEmpty(Spawn) && Characters.Sein != null)
            {
                int   index = -1;
                float dist  = float.MaxValue;
                for (int i = 0; i < RespawningPlaceholder.All.Count; i++)
                {
                    RespawningPlaceholder rp = RespawningPlaceholder.All[i];
                    bool wasNull             = false;
                    if (rp.CurrentEntity == null)
                    {
                        rp.Spawn();
                        wasNull = true;
                    }
                    if (rp.CurrentEntity.GetType().Name.IndexOf(Spawn, StringComparison.OrdinalIgnoreCase) >= 0)
                    {
                        float fdist = Vector3.Distance(rp.Position, Characters.Sein.Position);
                        if (fdist < dist)
                        {
                            dist  = fdist;
                            index = i;
                        }
                    }
                    if (wasNull)
                    {
                        rp.DestroyCurrentInstance();
                    }
                }

                if (index >= 0 && dist < 1000)
                {
                    RespawningPlaceholder rp = RespawningPlaceholder.All[index];
                    Vector3 old = rp.transform.position;
                    rp.transform.position = new Vector3(SpawnX, SpawnY, old.z);
                    rp.Spawn();
                    rp.transform.position = old;
                }
            }
            if (ResetDash && initial && Characters.Sein != null)
            {
                Characters.Sein.Abilities.Dash.ResetDashLimit();
            }
            if ((EntityPos || EntityHP >= 0) && initial && Characters.Sein != null)
            {
                SeinCharacter sein    = Characters.Sein;
                string        info    = string.Empty;
                float         minDist = float.MaxValue;
                int           index   = -1;
                for (int i = 0; i < Targets.Attackables.Count; i++)
                {
                    EntityTargetting attackable = Targets.Attackables[i] as EntityTargetting;
                    if (attackable != null && attackable.IsOnScreen && attackable.Activated)
                    {
                        float dist = Vector3.Distance(attackable.Position, sein.Position);
                        if (dist < minDist)
                        {
                            index   = i;
                            minDist = dist;
                        }
                    }
                }

                if (index >= 0)
                {
                    EntityTargetting attackable = Targets.Attackables[index] as EntityTargetting;
                    if (EntityPos)
                    {
                        attackable.Entity.Position = new Vector3(EntityPosX, EntityPosY);
                    }
                    if (EntityHP >= 0)
                    {
                        if (attackable.Entity.DamageReciever.MaxHealth < EntityHP)
                        {
                            attackable.Entity.DamageReciever.MaxHealth = EntityHP;
                        }
                        attackable.Entity.DamageReciever.Health = EntityHP;
                    }
                }
            }
            if (HP >= 0 && initial && Characters.Sein != null)
            {
                Characters.Sein.Mortality.Health.SetAmount(HP);
            }
            if (EN >= 0 && initial && Characters.Sein != null)
            {
                Characters.Sein.Energy.SetCurrent(EN);
            }
            if (Position && initial)
            {
                SeinCharacter sein = Characters.Sein;
                sein.Position = new UnityEngine.Vector3(PositionX, PositionY);
            }
            if (Speed && initial)
            {
                SeinCharacter sein = Characters.Sein;
                sein.Speed = new UnityEngine.Vector3(SpeedX, SpeedY);
            }
            if (XP >= 0 && initial)
            {
                SeinCharacter sein = Characters.Sein;
                sein.Level.Experience = XP;
            }
            if (UI && initial)
            {
                SeinUI.DebugHideUI = !SeinUI.DebugHideUI;
            }
            if (Color && initial && Characters.Sein != null)
            {
                CheatsHandler.Instance.ChangeCharacterColor();
            }
            if (NoColor && initial && Characters.Sein != null)
            {
                Characters.Sein.PlatformBehaviour.Visuals.SpriteRenderer.material.color = new Color(0.50196f, 0.50196f, 0.50196f, 0.5f);
            }

            if (!Position && MouseX > -0.1 && MouseY > -0.1)
            {
                UnityEngine.Vector2 vector = new UnityEngine.Vector2(MouseX, MouseY);
                Core.Input.CursorMoved    = (UnityEngine.Vector2.Distance(vector, Core.Input.CursorPosition) > 0.0001f);
                Core.Input.CursorPosition = vector;
                TASPlayer.LastMouseX      = MouseX;
                TASPlayer.LastMouseY      = MouseY;
            }
            else
            {
                Core.Input.CursorPosition = new UnityEngine.Vector2(TASPlayer.LastMouseX, TASPlayer.LastMouseY);
                Core.Input.CursorMoved    = false;
            }

            Core.Input.HorizontalAnalogLeft = XAxis;
            Core.Input.Horizontal           = XAxis;
            Core.Input.VerticalAnalogLeft   = YAxis;
            Core.Input.Vertical             = YAxis;
            PlayerInput.Instance.ApplyDeadzone(ref Core.Input.HorizontalAnalogLeft, ref Core.Input.VerticalAnalogLeft);
            Core.Input.HorizontalAnalogRight = 0;
            Core.Input.VerticalAnalogRight   = 0;
            PlayerInput.Instance.ApplyDeadzone(ref Core.Input.HorizontalAnalogRight, ref Core.Input.VerticalAnalogRight);
            Core.Input.HorizontalDigiPad = (int)XAxis;
            Core.Input.VerticalDigiPad   = (int)YAxis;

            Core.Input.AnyStart.Update(Jump || Start);
            Core.Input.ZoomIn.Update(Glide);
            Core.Input.ZoomOut.Update(ChargeJump);
            Core.Input.LeftClick.Update(false);
            Core.Input.RightClick.Update(false);

            Core.Input.Jump.Update(Jump);
            Core.Input.SpiritFlame.Update(Fire);
            Core.Input.SoulFlame.Update(Save);
            Core.Input.Bash.Update(Bash);
            Core.Input.ChargeJump.Update(ChargeJump);
            Core.Input.Glide.Update(Glide);
            Core.Input.Grab.Update(Glide);
            Core.Input.LeftShoulder.Update(Grenade);
            Core.Input.RightShoulder.Update(Dash);
            Core.Input.Select.Update(Select);
            Core.Input.Start.Update(Start);
            Core.Input.LeftStick.Update(false);
            Core.Input.RightStick.Update(false);

            Core.Input.MenuDown.Update(YAxis == -1);
            Core.Input.MenuUp.Update(YAxis == 1);
            Core.Input.MenuLeft.Update(XAxis == -1);
            Core.Input.MenuRight.Update(XAxis == 1);
            Core.Input.MenuPageLeft.Update(ChargeJump);
            Core.Input.MenuPageRight.Update(Glide);
            Core.Input.ActionButtonA.Update(Action);
            Core.Input.Cancel.Update(Esc);
            Core.Input.Copy.Update(Fire);
            Core.Input.Delete.Update(Bash);
            Core.Input.Focus.Update(Fire);
            Core.Input.Filter.Update(Fire);
            Core.Input.Legend.Update(Bash);
        }