Esempio n. 1
0
    void Awake()
    {
        Hp = InitialLifes = ConfigReader.GetConfig().GetField("hero").GetField("InitialLifes").n;
        AttackDistance = ConfigReader.GetConfig().GetField("hero").GetField("AttackDistance").n;
        AttackReloadPeriod = ConfigReader.GetConfig().GetField("hero").GetField("AttackReloadPeriod").n;
        Velocity = ConfigReader.GetConfig().GetField("hero").GetField("Velocity").n;
        AttackReactionPeriod = ConfigReader.GetConfig().GetField("hero").GetField("AttackReactionPeriod").n;
        AttackReloadPeriod = ConfigReader.GetConfig().GetField("hero").GetField("AttackReloadPeriod").n;
        MovingToDragTargetVelocity = ConfigReader.GetConfig().GetField("hero").GetField("MovingToDragTargetVelocity").n;
        HpPercent = 100;

        IdleState idleState = new IdleState(this);
        ConductorMoveState moveState = new ConductorMoveState(this);
        ConductorDragState dragState = new ConductorDragState(this);
        AttackState attackState = new AttackState(this);
        AttackedState attackedState = new AttackedState(this);
        FrozenState frozenState = new FrozenState(this);
        Dictionary<int, State> stateMap = new Dictionary<int, State>
        {
            {(int) MovableCharacterStates.Idle, idleState},
            {(int) MovableCharacterStates.Move, moveState},
            {(int) MovableCharacterStates.Drag, dragState},
            {(int) MovableCharacterStates.Attack, attackState},
            {(int) MovableCharacterStates.Attacked, attackedState},
            {(int) MovableCharacterStates.Frozen, frozenState}
        };
        InitWithStates(stateMap, (int)MovableCharacterStates.Idle);
    }
Esempio n. 2
0
    void Awake()
    {
        Hp                         = InitialLifes = ConfigReader.GetConfig().GetField("hero").GetField("InitialLifes").n;
        AttackDistance             = ConfigReader.GetConfig().GetField("hero").GetField("AttackDistance").n;
        AttackReloadPeriod         = ConfigReader.GetConfig().GetField("hero").GetField("AttackReloadPeriod").n;
        Velocity                   = ConfigReader.GetConfig().GetField("hero").GetField("Velocity").n;
        AttackReactionPeriod       = ConfigReader.GetConfig().GetField("hero").GetField("AttackReactionPeriod").n;
        AttackReloadPeriod         = ConfigReader.GetConfig().GetField("hero").GetField("AttackReloadPeriod").n;
        MovingToDragTargetVelocity = ConfigReader.GetConfig().GetField("hero").GetField("MovingToDragTargetVelocity").n;
        HpPercent                  = 100;

        IdleState               idleState     = new IdleState(this);
        ConductorMoveState      moveState     = new ConductorMoveState(this);
        ConductorDragState      dragState     = new ConductorDragState(this);
        AttackState             attackState   = new AttackState(this);
        AttackedState           attackedState = new AttackedState(this);
        FrozenState             frozenState   = new FrozenState(this);
        Dictionary <int, State> stateMap      = new Dictionary <int, State>
        {
            { (int)MovableCharacterStates.Idle, idleState },
            { (int)MovableCharacterStates.Move, moveState },
            { (int)MovableCharacterStates.Drag, dragState },
            { (int)MovableCharacterStates.Attack, attackState },
            { (int)MovableCharacterStates.Attacked, attackedState },
            { (int)MovableCharacterStates.Frozen, frozenState }
        };

        InitWithStates(stateMap, (int)MovableCharacterStates.Idle);
    }