예제 #1
0
 public void SetAttacker(GameObject g)
 {
     attacker = g;
     if (attacker.gameObject.tag == "Player")
     {
         direction = attacker.GetComponent<CharacterMovementScript>().Direction;
         aimMode = attacker.GetComponent<CharacterMovementScript>().AimMode;
         if (aimMode)
         {
             testIKScript = GameObject.FindGameObjectWithTag("Player").GetComponent<TestIKScript>();
             position = testIKScript.lookObj.position;
             this.transform.LookAt(position);
         }
         else
         {
             //Debug.Log("Tossed Grenade");
             position = GameObject.FindGameObjectWithTag("LookAtObj").transform.position;
             this.transform.LookAt(position);
         }
     }
     else if (attacker.GetComponent<GuardController>())
     {
         if (attacker.GetComponent<GuardController>().movingSpeed < 0)
             direction = true;
         else
             direction = false;
     }
     else
     {
         position = GameObject.FindGameObjectWithTag("Player").transform.position;
         this.transform.LookAt(position);
     }
 }
예제 #2
0
    bool canfire;          //Used to stop certain attacks from firing into the time is right (mainly used for shooting);
    // Use this for initialization
    void Start()
    {
        player    = this.gameObject;
        paused    = false;
        rigidBody = player.GetComponent <Rigidbody> ();
        _moving   = false;
        _ground   = true;
        _crouch   = false;

        camera  = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera> ();
        canfire = false;
        aimBool = false;

        //This Script handles IK Stuff
        testIKScript = this.gameObject.GetComponent <TestIKScript>();

        player.transform.eulerAngles = new Vector3(0, 180, 0); // This means that the player will start facing left
        charAnimator = player.GetComponent <Animator> ();
        charAnimator.SetBool("moving", _moving);               // Means that the character is not movin, genrally in the idle
        charAnimator.SetBool("ground", _ground);               // Character is on the ground
        charAnimator.SetBool("running", _running);             // Character is Running
        charAnimator.SetBool("climbing", _climbing);
        charAnimator.SetBool("crouching", _crouch);
        currentWeapon = 2;
        charAnimator.SetInteger("currentWeapon", currentWeapon);
        //Set from 100->10 to make demo seem difficult.  Maybe make permenant?
        health = 100f;

        menu      = GameObject.FindGameObjectWithTag("Menu");
        healthBar = GameObject.FindGameObjectWithTag("HealthBar").GetComponent <Image>();
        menu.SetActive(false);
        //Health ();
    }
예제 #3
0
 public void SetAttacker(GameObject g)
 {
     attacker = g;
     if (attacker.gameObject.tag == "Player")
     {
         direction = attacker.GetComponent <CharacterMovementScript>().Direction;
         aimMode   = attacker.GetComponent <CharacterMovementScript>().AimMode;
         if (aimMode)
         {
             testIKScript = GameObject.FindGameObjectWithTag("Player").GetComponent <TestIKScript>();
             position     = testIKScript.lookObj.position;
             this.transform.LookAt(position);
         }
         else
         {
             //Debug.Log("Tossed Grenade");
             position = GameObject.FindGameObjectWithTag("LookAtObj").transform.position;
             this.transform.LookAt(position);
         }
     }
     else if (attacker.GetComponent <GuardController>())
     {
         if (attacker.GetComponent <GuardController>().movingSpeed < 0)
         {
             direction = true;
         }
         else
         {
             direction = false;
         }
     }
     else
     {
         position = GameObject.FindGameObjectWithTag("Player").transform.position;
         this.transform.LookAt(position);
     }
 }
    // Use this for initialization
    void Start()
    {
        player = this.gameObject;
        paused = false;
        rigidBody = player.GetComponent<Rigidbody> ();
        _moving = false;
        _ground = true;
        _crouch = false;

        camera = GameObject.FindGameObjectWithTag ("MainCamera").GetComponent<Camera> ();
        canfire = false;
        aimBool = false;

        //This Script handles IK Stuff
        testIKScript = this.gameObject.GetComponent<TestIKScript>();

        player.transform.eulerAngles = new Vector3 (0, 180, 0);// This means that the player will start facing left
        charAnimator = player.GetComponent<Animator> ();
        charAnimator.SetBool ("moving", _moving); // Means that the character is not movin, genrally in the idle
        charAnimator.SetBool ("ground", _ground);// Character is on the ground
        charAnimator.SetBool ("running", _running);// Character is Running
        charAnimator.SetBool ("climbing", _climbing);
        charAnimator.SetBool("crouching", _crouch);
        currentWeapon = 2;
        charAnimator.SetInteger("currentWeapon", currentWeapon);
        //Set from 100->10 to make demo seem difficult.  Maybe make permenant?
        health = 100f;

        menu = GameObject.FindGameObjectWithTag ("Menu");
        healthBar = GameObject.FindGameObjectWithTag("HealthBar").GetComponent<Image>();
        menu.SetActive (false);
        //Health ();
    }