Ejemplo n.º 1
0
        public void SetShield(ShieldType shieldType, float secs)
        {
            if (shieldComponent != null)
            {
                ParentScene.RemoveObject(shieldComponent);
                shieldComponent = null;
            }

            if (shieldComponentFront != null)
            {
                ParentScene.RemoveObject(shieldComponentFront);
                shieldComponentFront = null;
            }

            if (shieldType == ShieldType.None)
            {
                shieldTime = 0f;
                return;
            }

            shieldTime = secs * Time.FramesPerSecond;

            switch (shieldType)
            {
            case ShieldType.Fire:
                shieldComponent = new ShieldComponent(shieldType, false);
                shieldComponent.OnAttach(new ActorInstantiationDetails {
                    Api = api
                });
                shieldComponent.Parent = this;

                shieldComponentFront = new ShieldComponent(shieldType, true);
                shieldComponentFront.OnAttach(new ActorInstantiationDetails {
                    Api = api
                });
                shieldComponentFront.Parent = this;
                break;

            case ShieldType.Water:
                shieldComponentFront = new ShieldComponent(shieldType, true);
                shieldComponentFront.OnAttach(new ActorInstantiationDetails {
                    Api = api
                });
                shieldComponentFront.Parent = this;
                break;

            case ShieldType.Lightning:
                // ToDo
                break;

            case ShieldType.Laser:
                // ToDo
                break;
            }
        }