Ejemplo n.º 1
0
        public virtual void OnOwnerMakeDamage(ObjRetinue _this, ObjCharacter target, int damage)
        {
            if (null == target)
            {
                return;
            }

            if (target.ObjId == _this.ObjId || target.ObjId == _this.Owner.ObjId)
            {
                return;
            }

            _this.AddEnemy(target.ObjId);
            _this.EnterState(BehaviorState.Combat);
        }
Ejemplo n.º 2
0
        public virtual void OnOwnerReceiveDamage(ObjRetinue _this, ObjCharacter enemy, int damage)
        {
            if (null == enemy)
            {
                return;
            }

            if (enemy.ObjId == _this.ObjId || enemy.ObjId == _this.Owner.ObjId)
            {
                return;
            }

            _this.AddEnemy(enemy.ObjId);
            _this.EnterState(BehaviorState.Combat);
        }
Ejemplo n.º 3
0
        public void Tick(ObjRetinue _this, float delta)
        {
            ObjCharacter.GetImpl().Tick(_this, delta);

            if (0 == _this.mLogicTickCount % 10)
            {
                if (_this.Owner == null)
                {
                    _this.Scene.LeaveScene(_this);
                    return;
                }
                var rePos    = _this.GetPosition();
                var ownerPos = _this.Owner.GetPosition();
                var distance = (ownerPos - rePos).LengthSquared();
                if (distance > 64)
                {
                    _this.EnterState(BehaviorState.Idle);
                    _this.SetPosition(ownerPos);
                    _this.SyncCharacterPostion();
                }
            }
        }