コード例 #1
0
    private void Start()
    {
        lineRender     = GetComponent <LineRenderer>();
        playerBase     = GameObject.FindGameObjectWithTag("PlayerBase");
        unlocks        = GetComponentInParent <UnlockScript>();
        targetReticule = GameObject.FindGameObjectWithTag("CrossHair").GetComponent <Image>();

        //set up the rope attach point
        ropeAttachPoint = new GameObject();
        ropeAttachPoint.transform.name = "Rope Attach Point";
        ropeAttachPoint.AddComponent <Rigidbody>();
        ropeAttachPoint.GetComponent <Rigidbody>().isKinematic = true;
    }
コード例 #2
0
ファイル: PickupScript.cs プロジェクト: Oiral/Roller-Platform
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "PlayerBase")
        {
            UnlockScript unlocks = other.GetComponentInParent <UnlockScript>();
            Debug.Log("collision");
            if (unlocks == null)
            {
                return;
            }

            switch (typeOfPickup)
            {
            case pickupType.ropeLength:
                //check if the player has a grapple
                Debug.Log("Rope Length");
                unlocks.gameObject.GetComponentInChildren <SwingScript>().maxLength += 1;
                Destroy(gameObject);
                break;

            case pickupType.grapple:
                //check if the player has the rope
                unlocks.grapple = true;
                Destroy(gameObject);
                break;

            case pickupType.parachute:
                //check if the player doesnt have a glider script attached
                unlocks.glider = true;
                Destroy(gameObject);
                break;

            case pickupType.grappleWind:
                //Check if the player has the grapple
                unlocks.reel = true;
                Destroy(gameObject);
                break;

            default:
                break;
            }
        }
    }
コード例 #3
0
 private void Start()
 {
     moveScript = GetComponent <BB8MoveScript>();
     rb         = moveScript.bb8Base.GetComponent <Rigidbody>();
     unlocks    = GetComponentInParent <UnlockScript>();
 }