コード例 #1
0
ファイル: Climb.cs プロジェクト: JimSRush/MonsterMountain
    // Update is called once per frame
    void Update()
    {
        gameObject.transform.LookAt (mountPos);

        if (!next.isClimbable() && !falling) {
            falling = true;
            gameObject.AddComponent<Rigidbody>();
            GetComponent<Rigidbody>().AddForce(new Vector3(0,50,0));
            GameObject.Find ("Controller").GetComponent<AudioController>().randomScream();
            Instantiate (Resources.Load ("ClimberRag"), transform.position, Quaternion.identity);
            Destroy (gameObject);
            //StartCoroutine(kill());
        }

        if (!falling && Vector3.Distance (transform.position, aboveTheSnowVector) < 0.5f){
            if (next.getParent () != null) {
                next = next.getParent();
                mountPos = next.transform.position;
                //transform.rotation = Quaternion.AngleAxis (90, Vector3.up) * transform.rotation;
                aboveTheSnowVector = next.gameObject.transform.position;
                aboveTheSnowVector.x = next.gameObject.transform.position.x + 0.4f;
                if(next.tag.Equals("summit")) {
                    GameObject.Find("Controller").GetComponent<GameController>().madeItToTheTop();
                }
            }
        } else {
            transform.position = Vector3.MoveTowards(transform.position, aboveTheSnowVector, climbSpeed*Time.deltaTime);
        }
    }
コード例 #2
0
ファイル: Climb.cs プロジェクト: JimSRush/MonsterMountain
    // Update is called once per frame
    void Update()
    {
        gameObject.transform.LookAt(mountPos);

        if (!next.isClimbable() && !falling)
        {
            falling = true;
            gameObject.AddComponent <Rigidbody>();
            GetComponent <Rigidbody>().AddForce(new Vector3(0, 50, 0));
            GameObject.Find("Controller").GetComponent <AudioController>().randomScream();
            Instantiate(Resources.Load("ClimberRag"), transform.position, Quaternion.identity);
            Destroy(gameObject);
            //StartCoroutine(kill());
        }

        if (!falling && Vector3.Distance(transform.position, aboveTheSnowVector) < 0.5f)
        {
            if (next.getParent() != null)
            {
                next     = next.getParent();
                mountPos = next.transform.position;
                //transform.rotation = Quaternion.AngleAxis (90, Vector3.up) * transform.rotation;
                aboveTheSnowVector   = next.gameObject.transform.position;
                aboveTheSnowVector.x = next.gameObject.transform.position.x + 0.4f;
                if (next.tag.Equals("summit"))
                {
                    GameObject.Find("Controller").GetComponent <GameController>().madeItToTheTop();
                }
            }
        }
        else
        {
            transform.position = Vector3.MoveTowards(transform.position, aboveTheSnowVector, climbSpeed * Time.deltaTime);
        }
    }
コード例 #3
0
ファイル: Climb.cs プロジェクト: JimSRush/MonsterMountain
 public void setTarget(MountainNode targ)
 {
     next = targ;
 }
コード例 #4
0
ファイル: Climb.cs プロジェクト: JimSRush/MonsterMountain
 public void setTarget(MountainNode targ)
 {
     next = targ;
 }