コード例 #1
0
ファイル: Player.Effects.cs プロジェクト: iidioter/jazz2
        public void SetShield(ShieldType shieldType, float secs)
        {
#if !SERVER
            if (shieldDecor != null)
            {
                Scene.RemoveObject(shieldDecor);
                shieldDecor = null;
            }

            if (shieldComponentFront != null)
            {
                Scene.RemoveObject(shieldComponentFront);
                shieldComponentFront = null;
            }
#endif

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

            shieldTime = secs * Time.FramesPerSecond;

#if !SERVER
            switch (shieldType)
            {
            case ShieldType.Fire:
                shieldDecor = new ShieldDecor(shieldType, false);
                shieldDecor.OnActivated(new ActorActivationDetails {
                    LevelHandler = levelHandler
                });
                shieldDecor.Parent = this;

                shieldComponentFront = new ShieldDecor(shieldType, true);
                shieldComponentFront.OnActivated(new ActorActivationDetails {
                    LevelHandler = levelHandler
                });
                shieldComponentFront.Parent = this;
                break;

            case ShieldType.Water:
                shieldComponentFront = new ShieldDecor(shieldType, true);
                shieldComponentFront.OnActivated(new ActorActivationDetails {
                    LevelHandler = levelHandler
                });
                shieldComponentFront.Parent = this;
                break;

            case ShieldType.Lightning:
                // ToDo
                break;

            case ShieldType.Laser:
                // ToDo
                break;
            }
#endif
        }
コード例 #2
0
ファイル: Player.Shields.cs プロジェクト: fossabot/jazz2
        public void SetShield(ShieldType shieldType, float secs)
        {
            if (shieldDecor != null)
            {
                Scene.RemoveObject(shieldDecor);
                shieldDecor = null;
            }

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

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

            shieldTime = secs * Time.FramesPerSecond;

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

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

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

            case ShieldType.Lightning:
                // ToDo
                break;

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