Пример #1
0
        public override void Init(ShotController controller, Rigidbody2D rg)
        {
            float   speed   = this.UsesPowerModificator ? controller.CalculatedValueAfterPowerModification(this.InitSpeedInUnityUnits) : this.InitSpeedInUnityUnits;
            Vector2 forward = new Vector2(controller.gameObject.transform.up.x, controller.gameObject.transform.up.y);

            rg.velocity = forward * speed;
        }
Пример #2
0
        public override void Apply(ShotController controller, GameObject target)
        {
            DestructibleController destructible = target.GetComponent <DestructibleController>();

            if (destructible)
            {
                if (destructible.GetDestructibleData().IsAffectedByDamageType(controller.GetDamageType()))
                {
                    float damages = this.UsesPowerModificator ? controller.CalculatedValueAfterPowerModification(this.amountOfDamage) : this.amountOfDamage;
                    destructible.TakeDamage(damages);
                    GameObject.Destroy(controller.gameObject);
                }
            }
        }
Пример #3
0
        public override void Apply(ShotController controller, GameObject target)
        {
            float damages = this.UsesPowerModificator ? controller.CalculatedValueAfterPowerModification(this.ExplosionDamageAmount) : this.ExplosionDamageAmount;

            Instantiate(this.ExplosionPrefab, controller.gameObject.transform.position, controller.gameObject.transform.rotation);

            // TODO Add damages to the explosion (atm, does nothing more than prefab instantiation and impact damage)
            DestructibleController destructible = target.GetComponent <DestructibleController>();

            if (destructible)
            {
                if (destructible.GetDestructibleData().IsAffectedByDamageType(controller.GetDamageType()))
                {
                    destructible.TakeDamage(damages);
                }
            }

            GameObject.Destroy(controller.gameObject);
        }