Пример #1
0
    private void Update()
    {
        if (life.getLife() <= 0)
        {
            if (!isDieing)
            {
                isDieing = true;
                animation.Play("Anim_Death");
                dieingSound.Play();
                deathParticles.SetActive(true);
                Destroy(gameObject, animation.clip.length);
            }
            return;
        }

        if (navMeshAgent.isStopped)
        {
            state = StateAI.Attacking;
            if (!animation.isPlaying)
            {
                animation.Play("Anim_Attack");
                playerLife.decreaseLife(attackPower * Time.deltaTime);
                attackSound.Play();
            }
        }
        else
        {
            state = StateAI.Walking;
            if (!animation.isPlaying)
            {
                animation.Play("Anim_Run");
            }
        }
    }
Пример #2
0
    private void UpdateInformation()
    {
        //use it
        //state.regions[i].data.CalculateIncome(); - Доход провинции
        //state.army[i].GetUpkeep();
        StateAI ai = state.stateAI;

        allBudgetText.text = ai.treasury.ToString();
    }
Пример #3
0
 public void SetState02(StateAI _state)
 {
     if (state02 != null)
     {
         state02.ExitAction();
     }
     state02 = _state;
     state02.EntryAction();
 }
Пример #4
0
 public void SetState01(StateAI _state)
 {
     if (state01 != null)
     {
         state01.ExitAction();
     }
     state01 = _state;
     state01.EntryAction();
 }
Пример #5
0
 public State()
 {
     regions   = new List <Region>();
     army      = new List <Army>();
     persons   = new List <Person>();
     ships     = new List <Ship>();
     regiments = new BaseRegiment[GameConst.MaxRegimentCount];
     GameObject.Instantiate(PrefabHandler.TechnologyTree).InitializeTree(this);
     stateAI = new StateAI(this);
     stateAI.IncomeResources(new Treasury(500, 2000, 100, 100, 20));
     GameTimer.AddListener(StateDecaSecondUpdate, this);
 }
Пример #6
0
 void RunBrainStates()
 {
     currentState = FindState(stateName);
     if (currentState == null)
     {
         stateName     = "Not running any state...";
         stateDecision = "...";
         return;
     }
     stateName     = currentState.RunState();
     stateDecision = currentState.currentDecision;
 }
Пример #7
0
    void Start()
    {
        agent = GetComponent <Agent>();
        animationController = GetComponent <AnimationController>();

        agent.SetSpeed(character.speed);

        print("employeeData.construct " + employeeData.construct);
        if (employeeData.construct != "")
        {
            targetObject = GameObject.Find(employeeData.construct);
        }

        current_StateAI  = AIAsset.instance.FindState(employeeData.stateAI);
        current_ActionAI = AIAsset.instance.FindAction(employeeData.actionAI);
    }
Пример #8
0
 public AutoReasercher(StateAI state)
 {
     this.state     = state;
     technologyTree = state.Data.technologyTree;
 }
Пример #9
0
 public AutoPersonControl(StateAI stateAI)
 {
     state = stateAI;
 }
Пример #10
0
 public static void UpdateWantToTrade(StateAI state, List <(float, ResourcesType)> sortList)
Пример #11
0
 public AutoDiplomacy(StateAI stateAI)
 {
     state = stateAI;
 }
Пример #12
0
 public AutoBuilder(StateAI state)
 {
     this.state = state;
     provinces  = state.Data.regions;
 }
Пример #13
0
 public AutoRegimentBuilder(StateAI aI)
 {
     (stateAI, RiskI, RiskII, RiskIII) = (aI, new HashSet <RegionProxi>(), new HashSet <RegionProxi>(), new HashSet <RegionProxi>());
     //CreateTemplates();
 }
Пример #14
0
 public void TransitionToState(StateAI new_StateAI)
 {
     current_StateAI = new_StateAI;
 }