Пример #1
0
        public override bool ApplyEffect(AActor2D actor) {
            base.ApplyEffect(actor);
            MovementControls actorMvmnt = actor.MvmntCmp;
            if (actorMvmnt == null)
                return false;

            actorMvmnt.SetMaxSpeed(actorMvmnt.MaxRunSpeed * StaggerSpeed);
            return true;
        }//ApplyEffect
Пример #2
0
        }//Start


        public virtual void RegisterActor(AActor2D actor) {
#if UNITY_EDITOR
            if (ActorParent != null) {
                string msg = "Overwriting ActorCmp from RegisterActor while ActorParent is set from Editor in '{0}'!";
                Debug.LogWarning(string.Format(msg, this.name));
            }
#endif
            _actor = actor;
        }//RegisterActor
Пример #3
0
        }//ApplyEffect


        public override bool RemoveEffect(AActor2D actor) {
            base.RemoveEffect(actor);
            MovementControls actorMvmnt = actor.MvmntCmp;
            if (actorMvmnt == null)
                return false;

            actorMvmnt.ResetMaxSpeed();

            return true;
        }//RemoveEffect
Пример #4
0
    }//UnsetImposter

    public void KillTargetOnDeath(GameObject go)
    {
        //This actor is Not an imposter. Prbbly a Player.
        if (this.Target == null)
        {
            return;
        }

        //Imposter reveild. Cant damage Player anymore.
        if (this.origSprite == SpriteCmp.sprite)
        {
            return;
        }

        AActor2D targetActor = Impostered.ThisActor;

        targetActor.DamagableCmp.TakeDamage(this.gameObject, int.MaxValue, false);
    }//KillTargetOnDeath
Пример #5
0
        }//OnEnemyDied

        private void subscribeToDeathEvent(bool state)
        {
            for (int i = 0; i < this.enemies.Count; i++)
            {
                AActor2D enemy = this.enemies[i];
                if (enemy.DamagableCmp == null)
                {
                    return;
                }
                enemy.DamagableCmp.EOnDeath -= OnEnemyDied;
                if (state)
                {
                    enemy.DamagableCmp.EOnDeath += OnEnemyDied;
                }
            }//for

            hasInit = true;
        }//subscribeToDeathEvent
Пример #6
0
        public void Start()
        {
            //Not set manually? Therefore either in parent or in self.
            if (ControlledBy == null)
            {
                ControlledBy = GetComponentInParent <AActor2D>();
                if (ControlledBy == null)
                {
                    ControlledBy = GetComponent <AActor2D>();
                }
            }

            ColliderCmp      = GetComponentInChildren <Collider2D>();
            LadderClimberCmp = GetComponentInParent <LadderClimber>();

            DamagableCmp = ControlledBy.DamagableCmp;
            DamagableCmp.EOnDamageTaken += OnDamageTaken;
            DamagableCmp.EOnCritHit     += OnDamageTaken;
            StateMachineAnimator.Rebind();
        }//Start
 public void Start() {
     if(Owner == null)
         Owner = GetComponentInParent<AActor2D>();
 }//Start
Пример #8
0
     /* ---------------------- ---------------------- ---------------------- */


        public void Start() {
            if (this.Actor == null)
                this.Actor = GetComponent<AActor2D>();
            _input = this.Actor.GetComponent<InputManager>();
        }//Start
Пример #9
0
        }//ApplyEffect


        public virtual bool RemoveEffect(AActor2D actor) {
            this.timeOfApply = -1f;
            return true;
        }//RemoveEffect
Пример #10
0
 public virtual bool ApplyEffect(AActor2D actor) {
     this.timeOfApply = Time.timeSinceLevelLoad;
     return true;
 }//ApplyEffect
Пример #11
0
        }//RegisterActor


        /// <summary>
        /// Something that is called on Start to initiate components states and such.
        /// </summary>
        protected virtual void init() {
            if (ActorCmp == null)
                _actor = GetComponentInParent<AActor2D>();
            if (ActorCmp == null)
                _actor = GetComponent<AActor2D>();
        }//init
Пример #12
0
 public void Start()
 {
     _actor = GetComponent <AActor2D>();
 }