Esempio n. 1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        DynamicPlayerController player = collision.GetComponent <DynamicPlayerController>();

        // We only care about things that enter our trigger volume when they have a DynamicPlayerController
        // (ie. a Player) that is part of that game object.
        if (player == null)
        {
            return;
        }

        // We only care about setting our connectedBody if it does not already
        // have a refernece to a rigid body.
        SpringJoint2D balloonSpringJoint = this.GetComponent <SpringJoint2D>();

        if (balloonSpringJoint.connectedBody != null)
        {
            return;
        }


        Rigidbody2D playerRigidBody = player.GetComponent <Rigidbody2D>();

        balloonSpringJoint.connectedBody   = playerRigidBody;
        balloonSpringJoint.connectedAnchor = Vector2.up * 0.4f; // 0, 0.4
    }
Esempio n. 2
0
    void Start()
    {
        currentWeapon = DataHelper.DEFAULT_SELECTED_WEAPON_INDEX;
        lastSelected  = GameObject.FindGameObjectWithTag("defaultWeapon").GetComponent <Button_SwitchWeapon>();
        mngScript     = Weapons_PUs_Manager.Instance;

        spCntScript = GetComponent <StaticPlayerController>();
        dpCntScript = GetComponent <DynamicPlayerController>();
    }
 void OnDisable()
 {
     g_singleton = null;
 }
 void OnEnable()
 {
     g_singleton = this;
 }