Beispiel #1
0
    public override void Start()
    {
        base.Start();

        // Initialize states.
        moveState           = new Samurai_MoveState(this, stateMachine, "move", moveStateData, this);
        idleState           = new Samurai_IdleState(this, stateMachine, "idle", idleStateData, this);
        playerDetectedState = new Samurai_PlayerDetectedState(this, stateMachine, "playerDetected", playerDetectedStateData, this);
        dodgeState          = new Samurai_DodgeState(this, stateMachine, "dodge", dodgeStateData, this);
        kickState           = new Samurai_KickState(this, stateMachine, "kick", kickStateData, this);
        punchState          = new Samurai_PunchState(this, stateMachine, "punch", punchStateData, this);
        axeKickState        = new Samurai_AxeKickState(this, stateMachine, "axeKick", axeKickStateData, this);
        chargeState         = new Samurai_ChargeState(this, stateMachine, "charge", chargeStateData, this);

        attackSwordState1 = new Samurai_AttackSword1(this, stateMachine, "kick", attackSword1StateData, this);
        attackSwordState2 = new Samurai_AttackSword2(this, stateMachine, "punch", attackSword2StateData, this);
        attackSwordState3 = new Samurai_AttackSword3(this, stateMachine, "axeKick", attackSword3StateData, this);

        stateMachine.Initialize(moveState);

        if (!afterImagePool)
        {
            afterImagePool = GameObject.Find("SamuraiAfterImagePool").GetComponent <PlayerAfterImagePool>();
        }
    }
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        GrowPool();
    }
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        Instance = this;
        GrowPool();
    }
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this);
     }
     GrowPool();
 }
Beispiel #5
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        GrowPool();
    }
Beispiel #6
0
    public void Initialize(Player player, PlayerAfterImagePool pool)
    {
        _pool = pool;
        _playerSpriteRenderer = player.PlayerAnimator.SpriteRenderer;

        _playerSpriteTransform = _playerSpriteRenderer.transform;

        _playerColor = _playerSpriteRenderer.color;

        transform.localScale = _playerSpriteTransform.localScale;
        // start new sprite sequence
        _alpha             = _alphaMax;
        _renderer.sprite   = _playerSpriteRenderer.sprite;
        transform.position = _playerSpriteTransform.position;
        transform.rotation = _playerSpriteTransform.rotation;
        _timeActivated     = Time.time;
        // remove the parent, so it doesn't follow player
        transform.SetParent(null);

        _isInitialized = true;
    }
Beispiel #7
0
    public override void Start()
    {
        base.Start();

        dust = GetComponentInChildren <ParticleSystem>();

        // Hit stop color
        defaultShader = spriteRenderer.material.shader;
        hitShader     = Shader.Find("GUI/Text Shader"); // For all white sprite on Hit

        // iFrame color
        regularColor        = Color.white;
        invulnerableColor   = Color.white;
        invulnerableColor.a = 0.5f;

        // After Image
        if (!afterImagePool)
        {
            afterImagePool = GameObject.Find("PlayerAfterImagePool").GetComponent <PlayerAfterImagePool>();
        }

        GM = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>();
    }
Beispiel #8
0
 private void Awake()
 {
     Instance = this;
     GrowPool();
 }
Beispiel #9
0
 private void Awake()
 {
     Instance = this;
 }
    }                                                                 //Allows the after image script to call this.

    private void Awake()
    {
        instance = this; //Sets this to a singleton
        GrowPool();      //Adds at least one item to the pool to begin.
    }