示例#1
0
    private Animator anim;                              // Reference to the Animator on the player


    void Awake()
    {
        // Setting up references.
        playerControl = GetComponent <playerControllerScript>();
        //healthBar = GameObject.Find("HealthBar").GetComponent<SpriteRenderer>();
        anim = GetComponent <Animator>();
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     currentHealth           = fullHealth;
     healthSlider.fillAmount = 0f;
     controlMovement         = GetComponent <playerControllerScript> ();
     playerAS = GetComponent <AudioSource> ();
     //rubyCount.text = collectedRubies.ToString();
 }
示例#3
0
    //	public GameObject rewardObject;

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            //		Instantiate(rewardObject, transform.position, Quaternion.identity);
            playerControllerScript mySpeed = other.gameObject.GetComponent <playerControllerScript>();
            mySpeed.decreaseSpeed();
            Destroy(transform.root.gameObject);
        }
    }
示例#4
0
    // Start is called before the first frame update
    void Start()
    {
        shooter  = GetComponent <Shooter>();
        animator = GetComponent <Animator>();
        playerControllerScript = GetComponent <playerControllerScript>();

        if (photonView.IsMine)
        {
            foreach (GameObject gameObject in FpsGameobjects)
            {
                gameObject.SetActive(true);
            }
            foreach (GameObject gameObject in soldierGameObjects)
            {
                gameObject.SetActive(false);
            }
            animator.SetBool("isSoldier", false);
            GameObject gameObject1 = Instantiate(playerUiPrefab);

            playerControllerScript.joystick        = gameObject1.transform.Find("Fixed Joystick").GetComponent <Joystick>();
            playerControllerScript.FixedTouchField = gameObject1.transform.Find("RotateTouchField").GetComponent <FixedTouchField>();

            gameObject1.transform.Find("ShootButton").GetComponent <Button>().onClick.AddListener(() => shooter.Fire());

            fpsCamera.enabled = true;
        }
        else
        {
            foreach (GameObject gameObject in FpsGameobjects)
            {
                gameObject.SetActive(false);
            }
            foreach (GameObject gameObject in soldierGameObjects)
            {
                gameObject.SetActive(true);
            }
            animator.SetBool("isSoldier", true);
            playerControllerScript.enabled = false;
            GetComponent <RigidbodyFirstPersonController>().enabled = false;
            fpsCamera.enabled = false;
        }
    }
示例#5
0
 // Use this for initialization
 void Start()
 {
     controlMovement = GetComponent <playerControllerScript> ();
     playerAS        = GetComponent <AudioSource> ();
     rubyCount.text  = collectedRubies.ToString();
 }