Beispiel #1
0
    private void OnTriggerEnter(Collider other)
    {
        HandBehaviour hand = other.GetComponent <HandBehaviour>();

        if (hand != null)
        {
            handsInside.Add(hand);
            hand.isDecreasing = false;
            hand.SetRotation(transform.parent.position);

            HandAudio handAd = hand.GetComponent <HandAudio>();
            if (classCounter[handAd.GetClass()] < maxCounter)
            {
                classCounter[handAd.GetClass()]++;
                handsAudios.Add(handAd);
                handAd.Play();
            }
        }
    }
Beispiel #2
0
    // PRIVATE MODIFIERS
    private void Start()
    {
        // Physics
        rb = GetComponent<Rigidbody>();
        hand_collider = GetComponent<Collider>();
        hand_collider.isTrigger = false; // allow collision with player walls before swinging

        // Trail
        trail = GetComponent<LineTrailRenderer>();
        trail.SetEmisionEnabled(false);

        // Audio
        hand_audio = GetComponentInChildren<HandAudio>();

        // Colors
        sprite_hand_inner.color = player_color;
        Color c = player_color;
        c.a = 0;
        trail.GetLine().SetColors(player_color, c);

        // Position
        start_pos = transform.position;
        pos_last = start_pos;

        // Strengh
        SetStrength(strength_max);
    }