void UpdateSecAttr()
 {
     for (int i = 0; i < (int)SecondaryAttributeName.Count; i++)
     {
         UILabel secAttr = secAttrPanel.transform.Find(((SecondaryAttributeName)i).ToString()).GetComponent <UILabel>();
         secAttr.text = ((SecondaryAttributeName)i).ToString() + " : " + status.GetSecondaryAttrubute((SecondaryAttributeName)i).AdjustedValue;
     }
 }
Exemple #2
0
    // Use this for initialization
    protected virtual void Start()
    {
        npc         = GetComponent <NPCController>();
        status      = npc.status;
        npc.OnDead += Dead;
        navAgent    = gameObject.GetComponent <NavMeshAgent>();
        //持續往某方向scan的時間
        scanTimeStep = 1f;

        //設定視野
        vision.radius             = IsRanger ? VisionRadious * RANGER_VISION_DEPTH_FIX_RATIO : VisionRadious;
        minFallowWhenIdleDistance = controller.radius * 2 * FALLOW_WHEN_IDLE_MIN_DISTANCE_BY_BODY_LANGTH;
        navAgent.speed            = MoveSpeed;
        navAgent.angularSpeed     = RotationSpeed;
        navAgent.acceleration     = status.GetSecondaryAttrubute(SecondaryAttributeName.MoveSpeed).AdjustedValue / 50;
        InGarrison = false;
        StartCoroutine("FSM");
        InvokeRepeating("Rotate", 0, ROTATION_UPDATE);
    }
    void RecoverConsumedAttribute()
    {
        //ResourceRecover
        status.GetConsumedAttrubute(ConsumedAttributeName.Health).CurValue
            += status.GetSecondaryAttrubute(SecondaryAttributeName.HealthRecoverRate)
               .AdjustedValue / 10 * CONSUMED_ATTRIBUTE_RECOVER_INTERVAL;

        status.GetConsumedAttrubute(ConsumedAttributeName.Mana).CurValue
            += status.GetSecondaryAttrubute(SecondaryAttributeName.ManaRecoverRate)
               .AdjustedValue / 10 * CONSUMED_ATTRIBUTE_RECOVER_INTERVAL;

        status.GetConsumedAttrubute(ConsumedAttributeName.Energy).CurValue
            += status.GetSecondaryAttrubute(SecondaryAttributeName.EnergyRecoverRate)
               .AdjustedValue / 10 * CONSUMED_ATTRIBUTE_RECOVER_INTERVAL;
    }