private void OnTriggerEnter(Collider other) { if (other.tag == "Wizard") { // Hit an enemy //other.gameObject.GetComponent<WizardMovement>().hitPlayer = shooter; //other.gameObject.GetComponent<WizardMovement>().hitBack(bullet.forward); WizardMovement wizardScript = other.gameObject.GetComponent <WizardMovement>(); wizardScript.lifeCount--; if (wizardScript.lifeCount == 0) { PhotonNetwork.Destroy(other.gameObject); } else { Vector3 spawnPos = new Vector3(973, -40, -400); wizardScript.photonView.RPC("setPosition", RpcTarget.All, spawnPos); wizardScript.photonView.RPC("updateUI", RpcTarget.All, wizardScript.lifeCount); //wizardScript._uiGo.SendMessage("UpdateText", SendMessageOptions.RequireReceiver); //PlayerUI uiObject = wizardScript._uiGo.GetComponent<PlayerUI>(); //uiObject.photonView.RPC("UpdateText", RpcTarget.All); } //PhotonNetwork.Destroy(gameObject); PhotonNetwork.Destroy(gameObject); } }
// Start is called before the first frame update void Start() { //get a reference to the wizard wizard = GameObject.Find("Wizard").GetComponent <WizardMovement>(); //get a refernece to the main camera main = Camera.main; //set the hight and width of the main camera height = 2f * main.orthographicSize; width = height * main.aspect; }
// Start is called before the first frame update void Start() { //get reference to the wizard Wizard = GameObject.Find("Wizard").GetComponent <WizardMovement>(); //set the direction of the bullet velocity = -Wizard.direction.normalized * speed; fireballPosition = transform.position; angle = Wizard.angleOfRotation + 90; sprite.transform.localRotation = Quaternion.Euler(0, 0, angle); }
public void SetTarget(WizardMovement _target) { if (_target == null) { Debug.LogError("<Color=Red><a>Missing</a></Color> PlayMakerManager target for PlayerUI.SetTarget.", this); return; } // Cache references for efficiency target = _target; if (gameObject.GetComponent <Text>().text != null) { gameObject.GetComponent <Text>().text = target.photonView.Owner.NickName + " : " + target.lifeCount; } targetTransform = this.target.GetComponent <Transform>(); targetRenderer = this.target.GetComponent <Renderer>(); CharacterController characterController = _target.GetComponent <CharacterController>(); // Get data from the Player that won't change during the lifetime of this Component if (characterController != null) { characterControllerHeight = characterController.height; } }
// Start is called before the first frame update void Start() { //get a refernece to the wizard wizard = GameObject.Find("Wizard").GetComponent <WizardMovement>(); }
private void Start() { wizardModel = GetComponent <WizardModel>(); wizardMovement = GetComponent <WizardMovement>(); wizardGroundCollider = GetComponentInChildren <BoxCollider2D>(); }