コード例 #1
0
        protected virtual void Awake()
        {
            Entity = GetComponent <Entity>();

            Controller = Dependancy.Get <AIController>(gameObject);
            Controller.Init(this);
        }
コード例 #2
0
        public override void Configure(Base data)
        {
            base.Configure(data);

            Turret = Dependancy.Get <BaseTowerSlotTurret>(gameObject);
            Turret.Set(this);
        }
コード例 #3
0
        protected override void Process()
        {
            var instance = Instantiate(prefab, transform.position, transform.rotation);

            instance.transform.SetParent(Projectile.transform.parent);

            var damage = Dependancy.Get <ProjectileDamage>(Projectile.gameObject);

            if (damage != null)
            {
                var colliders = Physics2D.OverlapCircleAll(transform.position, radius);

                for (int i = 0; i < colliders.Length; i++)
                {
                    var target = colliders[i].GetComponent <Entity>();

                    if (target == null)
                    {
                        continue;
                    }
                    if (target.gameObject.layer == gameObject.layer)
                    {
                        continue;
                    }

                    Projectile.DoDamage(damage.Value, Damage.Method.Effect, target);
                }
            }
        }
コード例 #4
0
ファイル: WorldUI.cs プロジェクト: Skilled-Tech/Tactical-War
        protected virtual void Awake()
        {
            Map    = Dependancy.Get <WorldMapUI>(gameObject);
            Region = Dependancy.Get <RegionUI>(gameObject);

            Modules.Configure(this);
        }
コード例 #5
0
 protected virtual void InvokeEditorStateUpdate(float oldValue, float newValue)
 {
     foreach (var item in Dependancy.GetAll <IEditorStateUpdate>(gameObject))
     {
         item.EDITOR_UpdateState(oldValue, newValue);
     }
 }
コード例 #6
0
        Projectile Create()
        {
            var instance = Instantiate(prefab, point.position, point.rotation);

            instance.name = "(" + Unit.name + ") " + prefab.name;

            var projectile = instance.GetComponent <Projectile>();

            projectile.Configure(Unit);

            projectile.AmmendLayer(Unit.Leader.Layer);
            projectile.SetVelocity(velocity);

            projectile.OnHit += (Collider2D collider) => OnProjectileHit(projectile, collider);

            var travelDistance = Dependancy.Get <ProjectileTravelDistance>(projectile.gameObject);

            if (travelDistance != null)
            {
                travelDistance.Range = Attack.Distance * 2f;
            }

            if (Template.Attack.Penetrate)
            {
                var penetration = Dependancy.Get <ProjectilePenetration>(projectile.gameObject);
                if (penetration != null)
                {
                    penetration.Value = Attack.Range.Value - 1 - Unit.Index;
                }
            }

            return(projectile);
        }
コード例 #7
0
ファイル: PlayerUI.cs プロジェクト: Skilled-Tech/Tactical-War
        public override void Configure(PlayerProponent data)
        {
            base.Configure(data);

            Units = Dependancy.Get <ProponentUnitsUI>(gameObject);

            Modules.Configure(this);
        }
コード例 #8
0
        public override void Configure(ProponentAbilities reference)
        {
            base.Configure(reference);

            Cooldown = Dependancy.Get <ProponentAbilityCooldown>(gameObject);

            Modules.Configure(this);
        }
コード例 #9
0
        void Awake()
        {
            List = Dependancy.Get <AbilitiesListUI>(gameObject);

            Selection = Dependancy.Get <AbilitySelectionUI>(gameObject);

            Modules.Configure(this);
        }
コード例 #10
0
        protected override void Start()
        {
            base.Start();

            var weapon = Dependancy.Get <Weapon>(gameObject, Dependancy.Scope.RecursiveToParents);

            weapon.OnAction += OnAction;
        }
コード例 #11
0
        protected override void Start()
        {
            base.Start();

            var entity = Dependancy.Get <Entity>(gameObject, Dependancy.Scope.RecursiveToParents);

            entity.OnDeath += OnDeath;
        }
コード例 #12
0
        public override void Configure(UnitsUI data)
        {
            base.Configure(data);

            List = Dependancy.Get <UnitSelectionListUI>(gameObject);

            Drag = Dependancy.Get <UnitSelectionDragUI>(gameObject);
        }
コード例 #13
0
        public override void Configure(AbilitiesUI data)
        {
            base.Configure(data);

            List = Dependancy.Get <AbilitiesSelectionListUI>(gameObject);

            Drag = Dependancy.Get <AbilitySelectionDragUI>(gameObject);
        }
コード例 #14
0
        public override void Configure(Base data)
        {
            base.Configure(data);

            List = new List <Unit>();

            Creator = Dependancy.Get <BaseUnitsCreator>(gameObject);
        }
コード例 #15
0
        public override void Configure(Unit reference)
        {
            base.Configure(reference);

            Component = Dependancy.Get <AudioSource>(gameObject);

            SFX = Dependancy.Get <SFXPlayer>(gameObject);
        }
コード例 #16
0
        public override void Configure(Proponent reference)
        {
            base.Configure(reference);

            Elements = new List <ProponentAbility>();

            Selection = Dependancy.Get <ProponentAbilitiesSelection>(gameObject);
        }
コード例 #17
0
        protected virtual void Reset()
        {
            source = Dependancy.Get <Selectable>(gameObject, Dependancy.Scope.RecursiveToParents);

            Graphic = GetComponent <Graphic>();

            on = off = (Graphic == null ? Color.white : Graphic.color);
        }
コード例 #18
0
ファイル: Tools.cs プロジェクト: Skilled-Tech/Tactical-War
            public static void Set(Transform transform, string layer)
            {
                var renderes = Dependancy.GetAll <Renderer>(transform.gameObject);

                for (int i = 0; i < renderes.Count; i++)
                {
                    renderes[i].sortingLayerName = layer;
                }
            }
コード例 #19
0
ファイル: Login.cs プロジェクト: Skilled-Tech/Tactical-War
        private void Awake()
        {
            Google  = Dependancy.Get <GoogleLogin>(gameObject);
            Email   = Dependancy.Get <EmailLogin>(gameObject);
            Guest   = Dependancy.Get <GuestLogin>(gameObject);
            Offline = Dependancy.Get <OfflineLogin>(gameObject);

            Modules.Configure(this);
        }
コード例 #20
0
        public virtual void Configure(Proponent leader, IUnitSelectionData data)
        {
            this.Leader = leader;

            this.Template = data.Template;

            Upgrades = Dependancy.Get <UnitUpgrades>(gameObject);
            Upgrades.Set(data.Upgrades);
        }
コード例 #21
0
        public override void Execute()
        {
            if (audioSource == null)
            {
                throw Dependancy.FormatException(nameof(audioSource), this);
            }

            StartCoroutine(Procedure());
        }
コード例 #22
0
        protected virtual void UpdateModules(float value)
        {
            var dependancies = Dependancy.GetAll <Module>(gameObject);

            foreach (var dependancy in dependancies)
            {
                dependancy.OnValueChanged(value);
            }
        }
コード例 #23
0
        protected virtual void Awake()
        {
            Health        = Dependancy.Get <Health>(gameObject);
            Defense       = Dependancy.Get <EntityDefense>(gameObject);
            StatusEffects = Dependancy.Get <EntityStatusEffects>(gameObject);
            TimeScale     = Dependancy.Get <EntityTimeScale>(gameObject);

            Modules.Configure(this);
        }
コード例 #24
0
        public override void Execute()
        {
            if (target == null)
            {
                throw Dependancy.FormatException(nameof(target), this);
            }

            target.Hide();
        }
コード例 #25
0
        public virtual void Configure(BaseTowerSlots slots)
        {
            this.slots = slots;

            Buy  = Dependancy.Get <BaseTowerSlotBuyContextUI>(gameObject);
            Use  = Dependancy.Get <BaseTowerSlotsUseContextUI>(gameObject);
            Sell = Dependancy.Get <BaseTowerSlotBuyContextUI>(gameObject);

            Modules.Configure(this);
        }
コード例 #26
0
        void Start()
        {
            label = GetComponent <Text>();

            entity = Dependancy.Get <Entity>(gameObject, Dependancy.Scope.RecursiveToParents);

            entity.OnHealthChange += OnChange;

            UpdateState();
        }
コード例 #27
0
ファイル: Base.cs プロジェクト: Skilled-Tech/Tactical-War
        public virtual void Configure(Proponent data)
        {
            Proponent = data;

            Units   = Dependancy.Get <BaseUnits>(gameObject);
            Tower   = Dependancy.Get <BaseTower>(gameObject);
            Graphic = Dependancy.Get <BaseGraphic>(gameObject);

            Modules.Configure(this);
        }
コード例 #28
0
        protected virtual void Awake()
        {
            Entity = GetComponent <Entity>();

            Input = Dependancy.Get <PlayerInput>(gameObject);

            Navigator = Dependancy.Get <PlayerNavigator>(gameObject);

            weapon.Init(Entity);
        }
コード例 #29
0
ファイル: UnitsUI.cs プロジェクト: Skilled-Tech/Tactical-War
        void Awake()
        {
            List = Dependancy.Get <UnitsListUI>(gameObject);

            Context = Dependancy.Get <UnitContextUI>(gameObject);

            Selection = Dependancy.Get <UnitSelectionUI>(gameObject);

            Modules.Configure(this);
        }
コード例 #30
0
        public override void Configure(WorldUI data)
        {
            base.Configure(data);

            Levels     = Dependancy.Get <LevelsUIList>(gameObject);
            Difficulty = Dependancy.Get <RegionDifficultyContextUI>(gameObject);

            Selection = new WorldCore.SelectionData();

            Modules.Configure(this);
        }