Ejemplo n.º 1
0
        public string HappenEvent(ICharactor c)
        {
            IParameter exp = c.Status()["EXP"];

            exp.Add(expVolume);
            return(DecorateStyle("[Event]", "color") + $" Get {expVolume} Exp. You are lucky boy.");
        }
Ejemplo n.º 2
0
        //计算被攻击后的生命值
        public void GetRemainHp(ICharactor theAttacker)
        {
            //获取攻击者的攻击力
            int atkValue = theAttacker.GetAtkValue();

            //减少伤害值
            atkValue -= _attrStrategy.GetDmgDesValue(this);
            //计算生命值
            _nowHp -= atkValue;
        }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        p = new Human
        {
            Name = "Player"
        };

        target = transform.position;
        offset = mainCamera.transform.position - target;
    }
Ejemplo n.º 4
0
        //检测是否进入了进攻范围
        public override bool TargetRange(ICharactor theNearTarget, int range)
        {
            float targetdist;

            targetdist = Vector3.Distance(TheTarget.transform.position, theNearTarget.transform.position);
            if (targetdist <= range)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 5
0
        public override void Update(List <ICharactor> targets)
        {
            Vector3    nowPosition   = CharactorAi.GetPosition();
            ICharactor theNearTarget = null;
            float      minDist       = 999f;

            foreach (var target in targets)
            {
                if (target != null)
                {
                    if (target.BKilled)
                    {
                        continue;
                    }

                    float dist = Vector3.Distance(nowPosition, target.transform.position);
                    if (dist < minDist)
                    {
                        minDist       = dist;
                        theNearTarget = target;
                    }
                }
            }

            Debug.Log(theNearTarget);

            if (theNearTarget == null)
            {
                return;
            }

            //如果检测到目标在攻击范围内,则切换到攻击状态
            if (CharactorAi.TargetRange(theNearTarget, 2))
            {
                CharactorAi.ChangeAiState(new AttackAIState(theAttackTarget: theNearTarget));
            }
            else //如果不在攻击范围内则切换到追赶状态
            {
                //在有效视野内才可以进行锁定追击
                if (CharactorAi.UsefulView(theNearTarget) < 90)
                {
                    CharactorAi.StopMove();
                    CharactorAi.ChangeAiState(new ChaseAiState(theTarget: theNearTarget));
                }
            }
        }
Ejemplo n.º 6
0
 //设置武器的拥有者
 public void SetWeaponOwner(ICharactor theCharactor)
 {
     WeaponOwner = theCharactor;
 }
Ejemplo n.º 7
0
 //武器攻击
 public abstract void WeaponAttack(ICharactor theTarget);
Ejemplo n.º 8
0
        //----------------------------------------------------------------------


        #region Public_Methods

        //移除AI对象
        public void RemoveAiTarget(ICharactor theTarget)
        {
            _aiState.RemoveTarget(theTarget);
        }
Ejemplo n.º 9
0
 //是否在指定距离内
 public virtual bool TargetRange(ICharactor theNearTarget, int range)
 {
     return(false);
 }
Ejemplo n.º 10
0
 public float UsefulView(ICharactor theTarget)
 {
     return(TheTarget.UsefulView(theTarget));
 }
Ejemplo n.º 11
0
 protected IActionInterface(ActionManager am)
 {
     Am          = am;
     CurAnimator = am.Charactor.MyAnimator;
     Charactor   = am.Charactor;
 }
Ejemplo n.º 12
0
 public ActionManager(ICharactor charactor)
 {
     Charactor = charactor;
 }
Ejemplo n.º 13
0
        public void InvokeEvent(ICharactor c)
        {
            string outText = chipEvent.HappenEvent(c);

            PublishMessageLog(outText);
        }
Ejemplo n.º 14
0
 public virtual void RemoveTarget(ICharactor target)
 {
     //移除目标
 }
Ejemplo n.º 15
0
     private readonly ICharactor _chasetarget = null; //追击的目标
     
 #endregion
     
     
     //----------------------------------------------------------------------
     
     
 #region Public_Methods
     
     //建造者
     public ChaseAiState(ICharactor theTarget)
     {
         _chasetarget = theTarget;
     }
Ejemplo n.º 16
0
 public AttackAIState(ICharactor theAttackTarget)
 {
     _attackTarget = theAttackTarget;
 }
Ejemplo n.º 17
0
 public void SetCharactor(ICharactor charactor)
 {
     m_charactor = charactor;
 }
Ejemplo n.º 18
0
 public virtual void  InitState(ICharactor charactor, List <ICharactor> targets = null, string stateName = "")
 {
     m_charactor = charactor;
     m_targets   = targets;
     m_stateName = stateName;
 }
Ejemplo n.º 19
0
        // Update is called once per frame
        void Update()
        {
            ICharactor c = target.GetComponent <ICharactorable>().Charactor();

            gui.SetText(c.ToString());
        }
Ejemplo n.º 20
0
 //Ai对象设置
 public void SetAiCharactor(ICharactor theTarget)
 {
     TheTarget = theTarget;
 }
Ejemplo n.º 21
0
 public override void WeaponAttack(ICharactor theTarget)
 {
     //声音
     //粒子特效
     //动作
 }
Ejemplo n.º 22
0
 //攻击目标
 public void Attack(ICharactor theTarget)
 {
     TheTarget.Attack(theTarget);
 }
Ejemplo n.º 23
0
 public void LookTarget(ICharactor theTarget)
 {
     TheTarget.LookTarget(theTarget);
 }
Ejemplo n.º 24
0
 public string HappenEvent(ICharactor c)
 {
     return("");
 }