示例#1
0
    private void Start()
    {
        meshAgent = GetComponent <NavMeshAgent>();
        IInvertory invertory = GetComponent <IInvertoryData>().Invertory;

        invertoryLogic = new InvertoryLogic(ref invertory);

        CharacterController characterController = GetComponent <CharacterController>();

        orcAIRotator = new AIOrcRotator(this.transform, 5);
        orcMove      = new AIOrcMove(this.transform, environment, 2f, characterController, meshAgent);

        AITargeter = new AITarget(this.transform);
        IOrcMovementInput orcMovementInput = new OrcMovementInput(ref AITargeter);

        orcMovementInput.DriveUpDirection = Vector3.forward;
        IOrcMovementLogic orcMovementLogic = new AIOrcMovementLogic(orcMovementInput, meshAgent, this.transform);

        IAIAttackInput  orcAttackInput = new AIOrcAttackInput(AITargeter);
        IOrcAttackLogic orcAttackLogic = new AIOrcAttackLogic(this.transform, ref orcAttackInput, 2.0f, ref orcMovementLogic);

        orcAIInput = new AIOrcInput(orcMovementLogic, orcAttackLogic, meshAgent);

        orcAIRotator.CanRotate = true;
        orcControl             = new OrcControl(ref orcMovementLogic, ref orcMove, ref animator, ref orcAttackLogic, ref orcAIRotator, ref invertoryLogic);

        commandableData = GetComponent <ICommandableData>();
        if (commandableData != null)
        {
            commandableData.CommandableUnit = new CommandableUnit(AITargeter);
            commandableData.EnableComponent(true);
        }
    }
示例#2
0
 void Start()
 {
     invertory       = GetComponent <IInvertoryData>().Invertory;
     isDataAvialable = invertory != null && weaponNameHolder != null && ammoHolder != null && invertory.NumberOfStashes != 0;
     if (isDataAvialable)
     {
         builder = new StringBuilder();
         UpdateWeaponInfo(invertory.CurrentWeapons);
     }
 }
示例#3
0
 private void Start()
 {
     IWeaponData[] weaponsData = GetComponentsInChildren <IWeaponData>();
     if (weaponsData.Length != 0)
     {
         List <IEquippedWeapon> invertoryItems = CreateInvertory(invertoryStructure.StashStructure, weaponsData.ToList());
         invertory      = new Invertory(invertoryItems);
         invertoryLogic = new InvertoryLogic(ref invertory);
     }
     else
     {
         invertoryLogic = new InvertoryLogic();
     }
 }
示例#4
0
 public InvertoryLogic(ref IInvertory invertory)
 {
     this.invertory = invertory;
 }