コード例 #1
0
ファイル: Casting.cs プロジェクト: hotbunga/BattlerightAddons
        private static bool OrbLogic()
        {
            var orb = EntitiesManager.CenterOrb;

            if (orb == null || !orb.IsValid || !orb.IsActiveObject)
            {
                return(false);
            }
            var livingObj = orb.Get <LivingObject>();

            if (livingObj.IsDead)
            {
                return(false);
            }

            var orbMapObj = orb.Get <MapGameObject>();

            if (!TargetSelection.CursorDistCheck(orbMapObj.Position))
            {
                return(false);
            }
            if (livingObj.Health <= 16)
            {
                Cast(AbilitySlot.Ability1);
                return(true);
            }

            if (!orbMapObj.IsHoveringNear())
            {
                return(false);
            }
            Cast(AbilitySlot.Ability1);
            return(true);
        }
コード例 #2
0
ファイル: Aiming.cs プロジェクト: hotbunga/BattlerightAddons
        public static void GetTargetAndAim()
        {
            var castingId = LocalPlayer.Instance.AbilitySystem.CastingAbilityId;
            var skill     = ActiveSkills.Get(castingId);

            if (skill == null)
            {
                return;
            }
            if (OrbLogic(skill, true))
            {
                return;
            }

            var prediction = TargetSelection.GetTargetPrediction(skill, ActiveSkills.GetData(skill.Slot));

            if (!prediction.CanHit)
            {
                if (OrbLogic(skill))
                {
                    Main.DebugOutput = "Attacking orb (no valid targets)";
                }
                else if (MenuHandler.InterruptSpells)
                {
                    LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                }
                return;
            }

            Main.DebugOutput            = "Aiming at " + prediction.Target.CharName;
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(prediction.CastPosition);
        }
コード例 #3
0
    public void Load()
    {
        GUIPanel.Pannels.Clear();

        InventoryWindow = new InventoryScreen();
        InventoryWindow.Init();

        SkillScreen = new CharcterScreen();
        SkillScreen.Init();

        StatusWindow = new PlayerStatus();
        StatusWindow.Init();

        Selector = new TargetSelection();
        Selector.Init();
        Selector.Enabled = false;

        Loot = new LootScreen();
        Loot.Init();
        Loot.Enabled = false;

        GameMenu = new InGameMenu();
        GameMenu.Init();
        GameMenu.Enabled = false;
        InMenu           = false;

        SetPlayer(GameState.Instance.PlayerObject);
    }
コード例 #4
0
ファイル: Game1.cs プロジェクト: leondepeon/DotalWar
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            startMenu = new StartMenu(this);


            firstPlayer = new PlayerInput(this);
            firstPlayer.TESTBINDING();

            EntityManager    = new EntityManager(this);
            SystemManager    = new SystemManager(this);
            ComponentManager = new ComponentManager(this);

            TestSelect      = new SelectionRectange(this);
            targetSelection = new TargetSelection(this);
            RenderSystem    = new RenderSystem(this);
            RenderComponent = new RenderComponent(this);
            testWorld       = new TestWorld(this);
            EntityCleaner   = new DeadParrotCollector(this);

            //DEBUG
            mouseClick          = Content.Load <Texture2D>(@"Graphics\Mouse0");
            mouseClickRectangle = new Rectangle((int)(Mouse.GetState().X) - mouseClick.Width / 2, (int)(Mouse.GetState().Y) - mouseClick.Height / 2, mouseClick.Width, mouseClick.Height);


            base.Initialize();
        }
コード例 #5
0
        public void AlignHorizontal(TargetSelection targetselection, Models.AlignmentHorizontal align)
        {
            targetselection = targetselection.ResolveToSelection(this._client);

            IVisio.VisHorizontalAlignTypes halign;
            var valign = IVisio.VisVerticalAlignTypes.visVertAlignNone;

            switch (align)
            {
            case VisioScripting.Models.AlignmentHorizontal.Left:
                halign = IVisio.VisHorizontalAlignTypes.visHorzAlignLeft;
                break;

            case VisioScripting.Models.AlignmentHorizontal.Center:
                halign = IVisio.VisHorizontalAlignTypes.visHorzAlignCenter;
                break;

            case VisioScripting.Models.AlignmentHorizontal.Right:
                halign = IVisio.VisHorizontalAlignTypes.visHorzAlignRight;
                break;

            default: throw new System.ArgumentOutOfRangeException();
            }

            const bool glue_to_guide = false;

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(AlignHorizontal)))
            {
                targetselection.Selection.Align(halign, valign, glue_to_guide);
            }
        }
コード例 #6
0
        public void AlignVertical(TargetSelection targetselection, Models.AlignmentVertical align)
        {
            targetselection = targetselection.ResolveToSelection(this._client);

            // Set the align enums
            var halign = IVisio.VisHorizontalAlignTypes.visHorzAlignNone;

            IVisio.VisVerticalAlignTypes valign;
            switch (align)
            {
            case VisioScripting.Models.AlignmentVertical.Top:
                valign = IVisio.VisVerticalAlignTypes.visVertAlignTop;
                break;

            case VisioScripting.Models.AlignmentVertical.Center:
                valign = IVisio.VisVerticalAlignTypes.visVertAlignMiddle;
                break;

            case VisioScripting.Models.AlignmentVertical.Bottom:
                valign = IVisio.VisVerticalAlignTypes.visVertAlignBottom;
                break;

            default: throw new System.ArgumentOutOfRangeException();
            }

            const bool glue_to_guide = false;

            // Perform the alignment
            using (var undoscope = this._client.Undo.NewUndoScope(nameof(AlignVertical)))
            {
                targetselection.Selection.Align(halign, valign, glue_to_guide);
            }
        }
コード例 #7
0
ファイル: GUIMaster.cs プロジェクト: JeffM2501/CSC370
    public void Load()
    {
        GUIPanel.Pannels.Clear();

        InventoryWindow = new InventoryScreen();
        InventoryWindow.Init();

        SkillScreen = new CharcterScreen();
        SkillScreen.Init();

        StatusWindow = new PlayerStatus();
        StatusWindow.Init();

        Selector = new TargetSelection();
        Selector.Init();
        Selector.Enabled = false;

        Loot = new LootScreen();
        Loot.Init();
        Loot.Enabled = false;

        GameMenu = new InGameMenu();
        GameMenu.Init();
        GameMenu.Enabled = false;
        InMenu = false;

        SetPlayer(GameState.Instance.PlayerObject);
    }
コード例 #8
0
        public void DistributeHorizontal(TargetSelection targetselection, Models.AlignmentHorizontal halign)
        {
            targetselection = targetselection.ResolveToSelection(this._client);

            if (targetselection.Selection.Count < 2)
            {
                return;
            }

            IVisio.VisUICmds cmd;

            switch (halign)
            {
            case VisioScripting.Models.AlignmentHorizontal.Left:
                cmd = IVisio.VisUICmds.visCmdDistributeLeft;
                break;

            case VisioScripting.Models.AlignmentHorizontal.Center:
                cmd = IVisio.VisUICmds.visCmdDistributeCenter;
                break;

            case VisioScripting.Models.AlignmentHorizontal.Right:
                cmd = IVisio.VisUICmds.visCmdDistributeRight;
                break;

            default: throw new System.ArgumentOutOfRangeException();
            }

            var app = targetselection.Selection.Application;

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(DistributeHorizontal)))
            {
                app.DoCmd((short)cmd);
            }
        }
コード例 #9
0
        public int GetShapeCount(TargetSelection targetselection)
        {
            targetselection = targetselection.ResolveToSelection(this._client);
            int count = targetselection.Selection.Count;

            return(count);
        }
コード例 #10
0
        public void Ungroup(TargetSelection target_selection)
        {
            var cmdtarget   = this._client.GetCommandTarget(CommandTargetFlags.RequireApplication);
            var application = cmdtarget.Application;

            application.DoCmd((short)IVisio.VisUICmds.visCmdObjectUngroup);
        }
コード例 #11
0
 // Use this for initialization
 void Start()
 {
     target = targetScript.GetComponent <TargetSelection>();
     //get the animator component
     RadialMenu = RadialMenu.GetComponent <Animator>();
     //disable it on start to stop it from playing the default animation
     RadialMenu.enabled = false;
 }
コード例 #12
0
ファイル: MenuSystem.cs プロジェクト: Zenatsu/Arena_RPG
 // Use this for initialization
 void Start()
 {
     target = targetScript.GetComponent<TargetSelection>();
     //get the animator component
     RadialMenu = RadialMenu.GetComponent<Animator>();
     //disable it on start to stop it from playing the default animation
     RadialMenu.enabled = false;
 }
コード例 #13
0
ファイル: CharacterMovement.cs プロジェクト: OMGAMON/Nin
 void Start()
 {
     target           = GameObject.Find("Target");
     steadyPoint      = GameObject.Find("SteadyPoint");
     destinationPoint = GameObject.Find("DestinationPoint");
     targetSelection  = target.GetComponent <TargetSelection> ();
     rb  = GetComponent <Rigidbody2D> ();
     col = GetComponent <BoxCollider2D> ();
 }
コード例 #14
0
        private static bool OrbLogic(SkillBase skill, bool shouldCheckHover = false)
        {
            var orb = EntitiesManager.CenterOrb;

            if (orb == null || !orb.IsValid || !orb.IsActiveObject)
            {
                return(false);
            }
            var livingObj = orb.Get <LivingObject>();

            if (livingObj.IsDead)
            {
                return(false);
            }

            var orbMapObj = orb.Get <MapGameObject>();
            var orbPos    = orbMapObj.Position;

            if (!TargetSelection.CursorDistCheck(orbPos))
            {
                return(false);
            }

            if (livingObj.Health <= 14 && skill.Slot == AbilitySlot.Ability1)
            {
                Main.DebugOutput            = "Attacking orb (Orb Steal)";
                LocalPlayer.EditAimPosition = true;
                LocalPlayer.Aim(orbPos);
                return(true);
            }
            if (livingObj.Health <= 22 && skill.Slot == AbilitySlot.Ability2)
            {
                Main.DebugOutput            = "Attacking orb (Orb Steal)";
                LocalPlayer.EditAimPosition = true;
                LocalPlayer.Aim(orbPos);
                return(true);
            }
            if (orbPos.Distance(LocalPlayer.Instance) > skill.Range ||
                shouldCheckHover && !orbMapObj.IsHoveringNear())
            {
                return(false);
            }

            if (shouldCheckHover)
            {
                Main.DebugOutput = "Attacking orb (mouse hovering)";
            }
            if (skill.SkillType == SkillType.Line && Prediction.UseClosestPointOnLine)
            {
                orbPos = GeometryLib.NearestPointOnFiniteLine(LocalPlayer.Instance.Pos().Extend(orbPos, 0.6f),
                                                              orbPos, Base.Main.MouseWorldPos);
            }
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(orbPos);
            return(true);
        }
コード例 #15
0
        public IVisio.Shape Group(TargetSelection targetselection)
        {
            targetselection = targetselection.ResolveToSelection(this._client);

            // the other way of doing this: this.Client.VisioApplication.DoCmd((short)IVisio.VisUICmds.visCmdObjectGroup);
            // but it doesn't return the group

            var g = targetselection.Selection.Group();

            return(g);
        }
コード例 #16
0
    // Use this for initialization
    void Start()
    {
        thisObject = gameObject;
        level = 1;
        expToLevel = 100;
        maxHP = 10;
        speed = 50f;
        currentHP = maxHP;
        scriptManager = GameObject.Find("ScriptManager");
        combatScript = scriptManager.GetComponent<CombatSys>();
        targetScript = scriptManager.GetComponent<TargetSelection>();

        playerAnimator = thisObject.GetComponent<Animator>();
        playerAnimator.enabled = false;
    }
コード例 #17
0
    // Use this for initialization
    void Start()
    {
        thisObject    = gameObject;
        level         = 1;
        expToLevel    = 100;
        maxHP         = 10;
        speed         = 50f;
        currentHP     = maxHP;
        scriptManager = GameObject.Find("ScriptManager");
        combatScript  = scriptManager.GetComponent <CombatSys>();
        targetScript  = scriptManager.GetComponent <TargetSelection>();



        playerAnimator         = thisObject.GetComponent <Animator>();
        playerAnimator.enabled = false;
    }
コード例 #18
0
        public void Nudge(TargetSelection targetselection, double dx, double dy)
        {
            if (dx == 0.0 && dy == 0.0)
            {
                return;
            }

            targetselection = targetselection.ResolveToSelection(this._client);

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(Nudge)))
            {
                var unitcode = IVisio.VisUnitCodes.visInches;

                // Move method: http://msdn.microsoft.com/en-us/library/ms367549.aspx
                targetselection.Selection.Move(dx, dy, unitcode);
            }
        }
コード例 #19
0
        public static void GetTargetAndAim()
        {
            var castingId = LocalPlayer.Instance.AbilitySystem.CastingAbilityId;

            if (castingId == 238454699 && MenuHandler.SkillBool("close_a3") && EnemiesInRange(2.5f).Count > 0)
            {
                Main.DebugOutput            = "Shielding self";
                LocalPlayer.EditAimPosition = true;
                LocalPlayer.Aim(LocalPlayer.Instance.Pos());
                return;
            }
            var skill = ActiveSkills.Get(castingId);

            if (skill == null)
            {
                return;
            }
            if (OrbLogic(skill, true))
            {
                return;
            }
            var prediction = skill.Slot == AbilitySlot.Ability5 ?
                             GetEPrediction(skill, ActiveSkills.GetData(skill.Slot)) :
                             TargetSelection.GetTargetPrediction(skill, ActiveSkills.GetData(skill.Slot), skill.Slot == AbilitySlot.Ability2);

            if (!prediction.CanHit)
            {
                if (OrbLogic(skill))
                {
                    Main.DebugOutput = "Attacking orb (no valid targets)";
                }
                else
                {
                    if (MenuHandler.InterruptSpells && (!MenuHandler.NeverInterruptE || skill.Slot != AbilitySlot.Ability5))
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                }
                return;
            }

            Main.DebugOutput            = "Aiming at " + prediction.Target.CharName;
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(prediction.CastPosition);
        }
コード例 #20
0
        public static void AimUlt()
        {
            var skill = ActiveSkills.Active.Get(AbilitySlot.Ability7);

            if (OrbLogic(skill, true))
            {
                return;
            }
            var prediction = TargetSelection.GetTargetPrediction(skill, ActiveSkills.GetData(skill.Slot), true);

            if (!prediction.CanHit)
            {
                Main.DebugOutput = OrbLogic(skill) ? "Attacking orb (no valid targets)" : "Cant find any targets";
                return;
            }
            Main.DebugOutput            = "Aiming at " + prediction.Target.CharName;
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(prediction.CastPosition);
        }
コード例 #21
0
ファイル: Aiming.cs プロジェクト: hotbunga/BattlerightAddons
        public static void GetTargetAndAim()
        {
            var castingId = LocalPlayer.Instance.AbilitySystem.CastingAbilityId;
            var skill     = ActiveSkills.Get(castingId);

            if (skill == null)
            {
                return;
            }
            if (OrbLogic(skill, true))
            {
                return;
            }
            var useOnIncaps = skill.Slot == AbilitySlot.Ability2 || skill.Slot == AbilitySlot.Ability5 ||
                              skill.Slot == AbilitySlot.Ability7;

            var prediction = skill.Slot == AbilitySlot.Ability1 && LocalPlayer.Instance.HasBuff("AscensionBuff")
                ? TargetSelection.GetTargetPrediction(Main.AscendedM1, Main.AM1Info, true) :
                             TargetSelection.GetTargetPrediction(skill, ActiveSkills.GetData(skill.Slot), useOnIncaps);

            if (!prediction.CanHit)
            {
                if (OrbLogic(skill))
                {
                    Main.DebugOutput = "Attacking orb (no valid targets)";
                }
                else
                {
                    if (skill.SkillType == SkillType.Line && skill.Slot != AbilitySlot.Ability7 && MenuHandler.InterruptSpells)
                    {
                        LocalPlayer.PressAbility(AbilitySlot.Interrupt, true);
                    }
                }
                return;
            }

            Main.DebugOutput            = "Aiming at " + prediction.Target.CharName;
            LocalPlayer.EditAimPosition = true;
            LocalPlayer.Aim(prediction.CastPosition);
        }
コード例 #22
0
ファイル: PlayerController.cs プロジェクト: moongame/Overhead
    // Function to be called by the new target when clicked
    public void SetTarget(GameObject _newTarget)
    {
        if (_newTarget != null)
        {
            if (currentTarget != null)
            {
                // If we have just targeted one enemy, but have not attacked him, deactivate his health bar
                TargetSelection ts = currentTarget.GetComponent <TargetSelection>();
                if (ts.GetHP() == ts.getMaximumHealth())
                {
                    ts.enemyHealthBar.SetActive(false);
                }

                // Obs: in ts.TakeDamageBy() we activate the enemy health bar by default

                // If had double clicked the same target, just destarget it
                if (_newTarget == currentTarget)
                {
                    currentTarget = null;
                    return;
                }
            }

            // Turns new target into currentTarget
            currentTarget = _newTarget;

            // Gets newTarget HP bar reference
            enemyHealthBar = currentTarget.GetComponent <TargetSelection> ().enemyHealthBar;

            // Active HP on top screen
            enemyHealthBar.SetActive(true);

            return;
        }

        currentTarget = _newTarget;
    }
コード例 #23
0
        public void DistributeVertical(TargetSelection targetselection, Models.AlignmentVertical valign)
        {
            targetselection = targetselection.ResolveToSelection(this._client);

            if (targetselection.Selection.Count < 2)
            {
                return;
            }


            IVisio.VisUICmds cmd;
            switch (valign)
            {
            case VisioScripting.Models.AlignmentVertical.Top:
                cmd = IVisio.VisUICmds.visCmdDistributeTop;
                break;

            case VisioScripting.Models.AlignmentVertical.Center:
                cmd = IVisio.VisUICmds.visCmdDistributeMiddle;
                break;

            case VisioScripting.Models.AlignmentVertical.Bottom:
                cmd = IVisio.VisUICmds.visCmdDistributeBottom;
                break;

            default: throw new System.ArgumentOutOfRangeException();
            }


            var app = targetselection.Selection.Application;

            using (var undoscope = this._client.Undo.NewUndoScope(nameof(DistributeVertical)))
            {
                app.DoCmd((short)cmd);
            }
        }