コード例 #1
0
ファイル: TaskPanelUI.cs プロジェクト: FarmLifeTeam/XDemo
        public void UpdateMultipleAttackTasks(FactionEntity sourceEntity, MultipleAttackManager multipleAttackComp)
        {
            if (multipleAttackComp == null)
            {
                return;
            }

            for (int attackID = 0; attackID < multipleAttackComp.AttackEntities.Length; attackID++) //go through all the attack entities
            {
                AttackEntity attackComp = multipleAttackComp.AttackEntities[attackID];
                if (!attackComp.IsLocked && !attackComp.IsActive()) //as long as the attack entity is not active and not locked, show a task to activate it:
                {
                    TaskUI taskUI = Add(new TaskUIAttributes
                    {
                        ID     = attackID,
                        type   = TaskTypes.attackTypeSelection,
                        icon   = attackComp.GetIcon(),
                        source = sourceEntity
                    }, multipleAttackComp.GetTaskPanelCategory());

                    if (attackComp.CoolDownActive == true) //if the attack type is in cool down mode
                    {
                        Color nextColor = taskUI.GetComponent <Image>().color;
                        nextColor.a = 0.5f; //make it semi-transparent to indicate cooldown to player
                        taskUI.GetComponent <Image>().color = nextColor;
                    }
                }
            }
        }
コード例 #2
0
ファイル: UnitAttack.cs プロジェクト: FarmLifeTeam/XDemo
        private bool triggerAnimationInDelay = false;                           //true => the attack animation is triggered when the delay starts. if false, it will only be triggered when the attack is triggered

        public override void Init(GameManager gameMgr, FactionEntity factionEntity, MultipleAttackManager multipleAttackMgr)
        {
            base.Init(gameMgr, factionEntity, multipleAttackMgr);
            this.unit = (Unit)factionEntity;

            RangeType = gameMgr.AttackMgr.GetRangeType(rangeTypeCode);
        }
コード例 #3
0
ファイル: AttackEntity.cs プロジェクト: FarmLifeTeam/XDemo
        public virtual void Init(GameManager gameMgr, FactionEntity factionEntity, MultipleAttackManager multipleAttackMgr)
        {
            this.FactionEntity     = factionEntity;
            this.multipleAttackMgr = multipleAttackMgr;
            this.gameMgr           = gameMgr;

            CoolDownActive = false;
            coolDownTimer  = 0.0f;

            searchTimer = 0.0f;
            reloadTimer = 0.0f;

            damage.Init(gameMgr, this); //initialize the damage settings
            attackObjectLauncher.Init(gameMgr, this);
            weapon.Init();

            reloadDuration /= gameMgr.GetSpeedModifier(); //apply the speed modifier
        }
コード例 #4
0
        Building building; //the building's main component

        public override void Init(GameManager gameMgr, FactionEntity factionEntity, MultipleAttackManager multipleAttackMgr)
        {
            base.Init(gameMgr, factionEntity, multipleAttackMgr);

            this.building = (Building)factionEntity;
        }
コード例 #5
0
        private bool triggerAnimationInDelay = false;                           //true => the attack animation is triggered when the delay starts. if false, it will only be triggered when the attack is triggered

        public override void Init(GameManager gameMgr, FactionEntity factionEntity, MultipleAttackManager multipleAttackMgr)
        {
            base.Init(gameMgr, factionEntity, multipleAttackMgr);
            this.unit = (Unit)factionEntity;
        }