Наследование: StateWill
Пример #1
0
 public SW_Shoot(int id, GameObject pBullet, float shootSpeed, SW_Dodge dodgeState=null)
     : base(id)
 {
     player = TeamManagerWill.instance.members[id].gameObject;
     shootCooldown = shootSpeed;
     bullet = pBullet;
     currentTarget = TeamManagerWill.instance.mainTarget;
     if (dodgeState != null)
     {
         dodge = dodgeState;
     }
 }
Пример #2
0
    void Start()
    {
        rigid = GetComponent<Rigidbody>();
        bullet = Resources.Load("Bullet") as GameObject;
        teamName = GetComponentInParent<TeamNumber>().teamName;

        // STATE
        SW_Dodge dodge = new SW_Dodge(id, speed, distanceDodge, timeToPos, graphName);
        SW_Shoot shoot = new SW_Shoot(id, bullet, shootSpeed, dodge);
        //FightStateMachineWill fight = new FightStateMachineWill(id, shoot);
        SW_Walk walk = new SW_Walk(id, speed, closeEnoughRange, graphName);

        // ADD TRANSITION
        walk.transitions.Add(new TW_VisionOnTarget(id, shoot, true));
        shoot.transitions.Add(new TW_VisionOnTarget(id, walk, false));

        // INIT MACHINE
        machine = new MainStateMachineWill(id,walk);
    }