示例#1
0
        public override void OnInitialized()
        {
            Equippable equippable = worlditem.Get <Equippable>();

            equippable.OnUnequip += OnUnequip;
            Skills.Get.SkillByName("Spyglass", out SpyglassSkill);
        }
示例#2
0
        public override void OnInitialized()
        {                                       //set up our equippable and damageable props
                                                //they have to be just so
            damageable = worlditem.GetOrAdd <Damageable>();
            equippable = worlditem.GetOrAdd <Equippable>();
            //we want to be equipped as a worlditem, always
            equippable.UseDoppleganger = false;
            equippable.Type            = PlayerToolType.Generic;

            damageable.OnTakeDamage += OnTakeDamage;
            //when the shield is gone it's gone
            damageable.State.Result = DamageableResult.RemoveFromGame;
        }
示例#3
0
 public override void OnInitialized()
 {
     if (IsDark)
     {
         worlditem.State = "Dark";
     }
     if (!IsGoodForHandHeld)
     {
         Equippable equippable = null;
         if (worlditem.Is <Equippable> (out equippable))
         {
             equippable.OnEquip += OnEquip;
         }
     }
 }
示例#4
0
        public override void OnInitialized()
        {
            Equippable equippable = null;

            if (worlditem.Is <Equippable>(out equippable))
            {
                equippable.CustomAction = this;
                equippable.OnEquip     += OnEquip;
                equippable.OnUnequip   += OnUnequip;
                equippable.OnUseStart  += OnUseStart;
                equippable.OnUseFinish += OnUseFinish;
                equippable.OnCycleNext += OnCycleNext;
                equippable.OnCyclePrev += OnCyclePrev;
                equippable.Type         = PlayerToolType.CustomAction;
            }
        }
示例#5
0
        public override void OnInitialized()
        {
            Weapon weapon = null;

            if (worlditem.Is <Weapon>(out weapon))
            {
                //subscribe to this so we know when we hit something with this weapon
                weapon.State.Damage.OnPackageReceived += OnPackageReceived;
            }
            Equippable equippable = null;

            if (worlditem.Is <Equippable>(out equippable))
            {
                //subscribe to this so we know when the weapons is equipped
                //(for fx purposes)
                equippable.OnEquip   += OnEquip;
                equippable.OnUnequip += OnUnequip;
            }
        }
示例#6
0
        public override void OnInitialized()
        {
            if (!State.HasInitializedValues)
            {
                State.BaseImpactTime       = BaseImpactTime;
                State.BaseUseSpeed         = BaseUseSpeed;
                State.BaseWindupDelay      = BaseWindupDelay;
                State.BaseSwingDelay       = BaseSwingDelay;
                State.BaseSwingRate        = BaseSwingRate;
                State.BaseSwingDuration    = BaseSwingDuration;
                State.BaseSwingImpactForce = BaseSwingImpactForce;
                State.BaseStrengthDrain    = BaseStrengthDrain;
                State.BaseRecoilIntensity  = BaseRecoilIntensity;
                State.BaseStrengthOnSwing  = BaseStrengthOnSwing;
                State.BaseAttackState      = BaseAttackState;
                State.ProjectileType       = ProjectileType;
                State.HasInitializedValues = true;
            }
            else
            {
                BaseImpactTime       = State.BaseImpactTime;
                BaseUseSpeed         = State.BaseUseSpeed;
                BaseWindupDelay      = State.BaseWindupDelay;
                BaseSwingDelay       = State.BaseSwingDelay;
                BaseSwingRate        = State.BaseSwingRate;
                BaseSwingDuration    = State.BaseSwingDuration;
                BaseSwingImpactForce = State.BaseSwingImpactForce;
                BaseStrengthDrain    = State.BaseStrengthDrain;
                BaseRecoilIntensity  = State.BaseRecoilIntensity;
                BaseStrengthOnSwing  = State.BaseStrengthOnSwing;
                BaseAttackState      = State.BaseAttackState;
            }

            Equippable equippable = null;

            if (worlditem.Is <Equippable>(out equippable))
            {
                equippable.OnUseStart += OnUseStart;
            }
        }
示例#7
0
        protected IEnumerator ActivateOverTime()
        {
            //wait for body to be added to group etc
            yield return(null);

            State.HasNewMessage = true;
            mTargetColor        = Colors.Get.GhostColor;
            if (mBodyBaseScale == Vector3.zero)
            {
                //only set it the first time or he'll shrink continuously
                mBodyBaseScale = mSpeakingCharacter.Body.transform.localScale;
            }
            mBodyTargetScale = mBodyBaseScale * CharacterBase.localScale.y;
            mCurrentColor    = Color.clear;
            CharacterBody body = (CharacterBody)mSpeakingCharacter.Body;

            mBodyMaterial = body.MainMaterial;
            mFaceMaterial = body.FaceMaterial;
            mBodyMaterial.SetColor("_RimColor", mCurrentColor);
            mFaceMaterial.SetColor("_RimColor", mCurrentColor);
            body.SetVisible(true);

            double waitUntil = WorldClock.AdjustedRealTime + gWarmUpDelay;

            while (WorldClock.AdjustedRealTime < waitUntil)
            {
                yield return(null);
            }

            ActiveLight.intensity = 0f;
            ActiveLight.enabled   = true;

            //if the ghost is already equipped or is in the world, we're finished
            //otherwise wait for the player to equip us
            while (!worlditem.Is(WIMode.Equipped | WIMode.World | WIMode.Frozen))
            {
                waitUntil = WorldClock.AdjustedRealTime + gWarmUpDelay;
                while (WorldClock.AdjustedRealTime < waitUntil)
                {
                    yield return(null);
                }
                //play a sound to let the player know we're active
                MasterAudio.PlaySound(SoundType, worlditem.tr, SoundOnActivated);
            }

            bool       inRangeOrReady = false;
            Equippable equippable     = worlditem.Get <Equippable> ();

            while (!inRangeOrReady)
            {
                if (worlditem.Is(WIMode.Equipped))
                {
                    if (equippable.FullyEquipped)
                    {
                        inRangeOrReady = true;
                    }
                }
                else
                {
                    //then wait until the player is in range before initiating conversation
                    if (Vector3.Distance(Player.Local.Position, worlditem.tr.position) < gMinimumSpeakDistance)
                    {
                        waitUntil = WorldClock.AdjustedRealTime + gWarmUpDelay;
                        while (WorldClock.AdjustedRealTime < waitUntil)
                        {
                            yield return(null);
                        }
                        MasterAudio.PlaySound(SoundType, worlditem.tr, SoundOnActivated);
                    }
                }
                yield return(null);
            }

            //we may become inactive at some point and get destroyed
            if (worlditem.Destroyed)
            {
                yield break;
            }

            //now that the player is in range and we're equipped or active, start the conversation
            Talkative t = mSpeakingCharacter.worlditem.Get <Talkative> ();

            t.State.ConversationName = State.CharacterConversation;
            t.State.DefaultToDTS     = false;
            t.SpeakThroughIntermediary(this);
            State.HasNewMessage = false;

            mActivating = false;
            yield break;
        }