Beispiel #1
0
    void OnCollisionEnter(Collision other)
    {
        if (other.gameObject.CompareTag("Tail"))
        {
            PlayerTail tail = other.gameObject.GetComponent <PlayerTail>();

            if (!canSelfKill && tail.playerRef == this)
            {
                return;
            }

            if (tail.isLast)
            {
                Kill();
                tail.playerRef.Death();
            }
            else
            {
                Death();
            }
        }

        //Head to head
        if (headOnheadDeath && other.gameObject.CompareTag("Player"))
        {
            Death();
        }
    }
Beispiel #2
0
    public void AddTailPart()
    {
        Vector3 tailPos;

        if (tailList.Count == 0)
        {
            tailPos = transform.position - spriteTransform.up * tailDistance;
        }
        else
        {
            tailPos = tailList[tailList.Count - 1].transform.position - tailList[tailList.Count - 1].transform.up * tailDistance;
        }

        PlayerTail tailPart = Instantiate(tailPrefab, tailPos, transform.rotation);

        tailPart.transform.SetPositionSphere(Dome.instance.radiusClose);
        tailPart.transform.rotation = transform.rotation;

        tailPart.isLast    = true;
        tailPart.playerRef = this;

        tailList.Add(tailPart);
        if (tailList.Count > 1)
        {
            tailList[tailList.Count - 2].isLast = false;
        }

        tailPart.transform.SetParent(emptyParent, false);
    }
Beispiel #3
0
    // private bool hit;

    void Awake()
    {
        audioController = GameObject.Find("AudioController").GetComponent <AudioController>();
        timerScript     = GameObject.Find("StartingLine").GetComponent <Timer>();
        playerGraphics  = GetComponentInChildren <PlayerGraphics>();
        playerTail      = GetComponentInChildren <PlayerTail>();
    }
Beispiel #4
0
 private void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerTail>();
 }