コード例 #1
0
ファイル: Switch.cs プロジェクト: thetylerace13/VGDC_Noir
    // Update is called once per frame
    void Update()
    {
        GameObject shadow = GameObject.FindWithTag("Shadow");

        ShadowMovement shadowMove = shadow.GetComponent <ShadowMovement>();
        PlayerMovement movement   = GetComponent <PlayerMovement>();

        if (Input.GetButtonDown("Switch"))
        {
            if (isShadow)
            {
                isShadow                 = false;
                shadowMove.enabled       = false;
                movement.enabled         = true;
                PlayerTracking.tagSearch = "PlayerCharacter";
            } // Switch to player
            else if (PlayerMovement.onGround && !isShadow && !Journal.inJournal)
            {
                isShadow                 = true;
                movement.enabled         = false;
                shadowMove.enabled       = true;
                PlayerTracking.tagSearch = "Shadow";
                PlayerMovement.isMoving  = false;
                movement.reAnimate();
            } // Switch to shadow
        }

        shadow.GetComponent <SpriteRenderer>().color = new Color(0.21176470588f, 0.22745098039f, 0.25882352941f, 1);
        // Shadow color, fades with distance
    }
コード例 #2
0
    // Use this for initialization
    void Start()
    {
        _animator  = GetComponent <Animator>();
        _rigidbody = GetComponent <Rigidbody>();

        GameObject shadowInstance = Instantiate(shadow);

        shadowInstance.name = "Shadow_Player";

        ShadowMovement script = shadowInstance.GetComponent <ShadowMovement>();

        script._gameObject = gameObject;
        script._offset     = new Vector3(0.0f, -0.15f, 0.0f);
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        GameObject shadowInstance = Instantiate(shadow);

        shadowInstance.name = "Shadow_Platform";

        ShadowMovement script = shadowInstance.GetComponent <ShadowMovement>();

        script._gameObject = gameObject;
        script._maxScale   = 2.5f;

        if (_movements.Length != 0)
        {
            initDirections();
            nextMovement();
        }
    }