Exemplo n.º 1
0
 void Awake()
 {
     statesManager = GetComponentInParent <CharacterStatesManager>();
     hammerThrown  = new CharacterState(ConstantStrings.Enemy.HammerBoss.HAMMER_THROWN, false);
     statesManager.RegisterCharacterState(hammerThrown.name, hammerThrown);
     hammerHitsGround = new CharacterState(ConstantStrings.Enemy.HammerBoss.HAMMER_HITS_GROUND, false);
     statesManager.RegisterCharacterState(hammerHitsGround.name, hammerHitsGround);
     thrownHammerPosition = statesManager.GetExistingCharacterState(ConstantStrings.Enemy.HammerBoss.THROWN_HAMMER_POSITION);
     hammerHitPlayer      = new CharacterState(ConstantStrings.Enemy.HammerBoss.HAMMER_HIT_PLAYER, false);
     statesManager.RegisterCharacterState(hammerHitPlayer.name, hammerHitPlayer);
     hammerHitEnemy = new CharacterState(ConstantStrings.Enemy.HammerBoss.HAMMER_HIT_ENEMY, false);
     statesManager.RegisterCharacterState(hammerHitEnemy.name, hammerHitEnemy);
 }
    // Use this for initialization
    void Start()
    {
        CharacterState.CharacterStateSubscription hammerStateSubscription = statesManager.GetCharacterStateSubscription(ConstantStrings.Enemy.HammerBoss.HAMMER_THROW_CAST_STATE);
        hammerStateSubscription.OnStateChanged += CheckHammerState;
        CharacterState.CharacterStateSubscription hammerHitPlayerSubscription = statesManager.GetCharacterStateSubscription(ConstantStrings.Enemy.HammerBoss.HAMMER_HIT_PLAYER);
        hammerHitPlayerSubscription.OnStateChanged += CheckHammerHitPlayerState;
        CharacterState.CharacterStateSubscription hammerHitGroundSubscription = statesManager.GetCharacterStateSubscription(ConstantStrings.Enemy.HammerBoss.HAMMER_HITS_GROUND);
        hammerHitGroundSubscription.OnStateChanged += CheckHammerHitGround;
        CharacterState.CharacterStateSubscription enemyHitHammerSubscription = statesManager.GetCharacterStateSubscription(ConstantStrings.Enemy.HammerBoss.HAMMER_HIT_ENEMY);
        enemyHitHammerSubscription.OnStateChanged += CheckEnemyHitHammerState;

        hammerThrown = statesManager.GetExistingCharacterState(ConstantStrings.Enemy.HammerBoss.HAMMER_THROWN);
        bcb          = GetComponentInParent <BossCastingBehavior>();
        spellStats   = GetComponent <SpellStats>();
        hammerMoving = false;
        hammerPickUp = true;
        psm          = GetComponent <ProjectileStraightMovement>();
        //Get hammer throw prefab
        hammerThrow    = bcb.GetAttack(2);
        rgb            = GetComponent <Rigidbody2D>();
        hammerPosition = new Vector2(0, 1.5f);        //Change this value to set how high boss holds hammer while walking
    }