protected virtual void Start()
    {
        if (Sounds)
        {
            myAudio = GetComponent <FMODEmitter>();
        }

        sr = GetComponent <SpriteRenderer>();



        // Find other buttons with same TriggerIndex
        otherButtons.AddRange(FindObjectsOfType <BaseButton>());

        if (useTriggerIndex)
        {
            for (int i = 0; i < otherButtons.Count; i++)
            {
                if (!otherButtons[i].GetComponent <BaseButton>().useTriggerIndex)
                {
                    continue;
                }

                if (otherButtons[i].GetComponent <BaseButton>().triggerIndex == triggerIndex)
                {
                    brothers.Add(otherButtons[i].gameObject);
                }
            }
        }
    }
    void Start()
    {
        emitter        = GetComponent <FMODEmitter>();
        particleClones = new List <GameObject>();
        rb             = GetComponent <Rigidbody2D>();
        pullObjects    = new List <GameObject>();

        ignoreObject = GameObject.FindGameObjectsWithTag("Player");
        foreach (GameObject IO in ignoreObject)
        {
            Physics2D.IgnoreCollision(IO.GetComponent <BoxCollider2D>(), GetComponent <CircleCollider2D>(), true);
        }

        buttonPressed        = true;
        gravitationActivated = false;
        targetting           = false;
        decreaseGravity      = 0;
        rotationSpeed        = 360f;

        FMODUnity.RuntimeManager.PlayOneShot(thrown, transform.position);

        if (transform.position.y > 0f)
        {
            rb.gravityScale = Mathf.Abs(rb.gravityScale);
        }
        else
        {
            rb.gravityScale = -Mathf.Abs(rb.gravityScale);
        }
    }
Example #3
0
    void Start()
    {
        playerController = GetComponent <PlayerController>();

        if (playerController.player == Controller.Player1)
        {
            pushAndPullBox += c1;
        }
        else
        {
            pushAndPullBox += c2;
        }
        distance = 1f;

        arm  = playerController.armAnim;
        body = playerController.bodyAnim;

        emitter = GetComponent <FMODEmitter>();
    }
Example #4
0
 public void OnEnable()
 {
     emitter = (FMODEmitter)target;
 }