コード例 #1
0
 public UnitMotor(IUnitInput input, JumpSystem jumpSystem, Rigidbody rb, UnitSettings settings)
 {
     this.input      = input;
     this.jumpSystem = jumpSystem;
     this.rb         = rb;
     this.settings   = settings;
 }
コード例 #2
0
    // add new attacksystem here

    private void Start()
    {
        playerInput = unitSettings.IsPlayer ? new PlayerController() as IUnitInput: new SlimeController();

        jumpSystem = new JumpSystem();
        motor      = new UnitMotor(playerInput, jumpSystem, GetComponent <Rigidbody>(), unitSettings);

        if (cam != null)
        {
            playerCamInput = new PlayerController();
            camMotor       = new PlayerCamMotor(playerCamInput, GetComponent <Transform>(), cam, unitSettings);
        }
    }
コード例 #3
0
    public void Init(IUnitInput i, UnitData d, List <Soldier> s, Unit u)
    {
        actions   = new Dictionary <string, UnityAction <string> >();
        input     = i;
        data      = d;
        soldiers  = s;
        unit      = u;
        selected  = false;
        unselect += Unselect;

        if (!unit.isAi)
        {
            unitNumber = ++UNIT_NUMBERS;
            unit.ChangeUnitNumber(unitNumber.ToString());
        }

        actions.Add(data.UnitName, Select);
        foreach (var action in Alias.GetWords())
        {
            if (Alias.GetOrder(action) == data.UnitName)
            {
                actions.Add(action, Select);
            }
            else if (action == "uno" || action == "dos" || action == "tres" || action == "cuatro" || action == "cinco" || action == "seis" || action == "siete" || action == "ocho" || action == "nueve")
            {
                actions.Add(action, Subselect);
            }
            else
            {
                actions.Add(action, Message);
            }
        }

        /*actions.Add("para", Message);
        *  actions.Add("esperen", Message);
        *  actions.Add("moveos", Message);
        *  actions.Add("aquí", Message);*/

        InitController();
        input.Init(actions, data, u);

        currentState = data.FirstState;
    }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     soldiers = GetComponentsInChildren <Soldier>().ToList();
     foreach (Soldier s in soldiers)
     {
         s.unit = this;
     }
     startingSoldiers = soldiers.Count;
     if (isAi == true)
     {
         input    = new AIUnitInput();
         allySet  = iaSet;
         enemySet = playerSet;
     }
     else
     {
         input    = new PlayerUnitInput();
         allySet  = playerSet;
         enemySet = iaSet;
     }
     controller = ControllerFactory.GetController(unitData.UnitName);
     controller.Init(input, unitData, soldiers, this);
 }