Exemple #1
0
    void Start()
    {
        var inactive = new InactiveState <Feed>(redLight);

        active = new ActiveState <Feed>(this, redLight);
        var explode = new ExplodeState <Feed>(explosionParticleSys, this);

        inactive.AddTransition(Feed.EnemigoEntraEnLOS, active);

        active.AddTransition(Feed.EnemigoSaleDeLOS, inactive);
        active.AddTransition(Feed.BOOOOM, explode);

        stateMachine = new FSM <Feed>(inactive);

        los = GetComponent <LOS>();
    }
Exemple #2
0
        public Unit()
        {
            StandState   stand     = new StandState(this);
            MoveState    move      = new MoveState(this, this, stand);
            ExplodeState explosion = new ExplodeState(this, this, model);

            stand.transitions.Add(0, stand);
            stand.transitions.Add(1, move);
            stand.transitions.Add(5, explosion);

            move.transitions.Add(0, stand);
            move.transitions.Add(5, explosion);

            Rect = new Rectangle(0, 0, UnitSizeTile.UnitSize, UnitSizeTile.UnitSize);

            State        = stand;
            State.Direct = Direction.Right;
        }
Exemple #3
0
        public Bullet(Logic m, Unit owner)
        {
            _logic = m;
            Owner  = owner;
            Speed  = owner.Gun.BulletSpeed;

            MoveState    moveState       = new MoveState(this);
            RespawnState respawningState = new RespawnState(this, this, moveState);
            ExplodeState explodeState    = new ExplodeState(this, this, _logic);

            MovingDirection = Owner.Gun.WeaponOpinion;

            CurrentPos = Owner.Gun.GunPos;
            CurrentPos = CurrentPos.Addition(MovingDirection.Multiplication(Speed * 4));

            moveState.transitions.Add(5, explodeState);
            State        = respawningState;
            State.Direct = Direction.Right;
        }