Beispiel #1
0
 private void Start()
 {
     rigidbody      = GetComponent <Rigidbody2D>();
     ghostGrab      = GetComponent <GhostGrab>();
     spriteRenderer = GetComponent <SpriteRenderer>();
     playerHeadAnimator.runtimeAnimatorController = playerHeadAnims[headAnimNumber];
 }
    public void CreateGhost(Vector3 pos)
    {
        if (GameManager.instance.SelectedGamemode != null)
        {
            if (GameManager.instance.SelectedGamemode.roundIsUnderway == false)
            {
                return;
            }
        }

        currentPlayerActionMap = "Ghost";
        if (playerInput != null)
        {
            playerInput.SwitchCurrentActionMap(currentPlayerActionMap);
        }

        currentGhost = Instantiate(ghostPrefab, pos, Quaternion.identity);
        currentGhost.transform.parent = transform;
        ghostMovement = currentGhost.GetComponent <GhostMovement>();
        ghostGrab     = currentGhost.GetComponent <GhostGrab>();
        ghostMovement.playerNumber   = playerNumber;
        ghostMovement.headAnimNumber = headIndex;
        ghostGrab.playerNumber       = playerNumber;
        ghostGrab.player             = this;
    }