コード例 #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>();
        }
    }
コード例 #2
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }

        GrowPool();
    }
コード例 #3
0
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(this.gameObject);
            return;
        }

        Instance = this;
        GrowPool();
    }
コード例 #4
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         Destroy(this);
     }
     GrowPool();
 }
コード例 #5
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }

        GrowPool();
    }
コード例 #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;
    }
コード例 #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>();
    }
コード例 #8
0
 private void Awake()
 {
     Instance = this;
     GrowPool();
 }
コード例 #9
0
 private void Awake()
 {
     Instance = this;
 }
コード例 #10
0
    }                                                                 //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.
    }