// Use this for initialization void Start() { Control = GameMgr.Instance.Control; InstantiateCanon(); GameMgr.Instance.IncreaseHp(HP, HPMax); StartCoroutine(InstantiateBonus()); }
public void rotation(Vector3 position, GameMgr.GameControl control) { if (par != null) { if (control == GameMgr.GameControl.Clavier) { Plane playerPlane = new Plane(Vector3.up, transform.position); if (type == Type.Enemy) { Debug.Log("Test"); } Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); float hitdist = 0.0f; if (playerPlane.Raycast(ray, out hitdist)) { Vector3 targetPoint = ray.GetPoint(hitdist); // bullet.transform.LookAt(targetPoint); Quaternion targetRotation = Quaternion.LookRotation(targetPoint - transform.position); // Smoothly rotate towards the target point. transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, 20.0f * Time.deltaTime); } } else { float moveX = Input.GetAxis("ManetteHorizontal"); float moveZ = Input.GetAxis("ManetteVertical"); Vector3 test = new Vector3(moveX, 0, moveZ); if (test != Vector3.zero) { Quaternion targetRotation = Quaternion.LookRotation(test); transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, 20.0f * Time.deltaTime); } } } }
public void SetManette() { controlActualy = GameMgr.GameControl.Manette; controlText.text = "Control : " + controlActualy.ToString(); }
public void SetClavier() { controlActualy = GameMgr.GameControl.Clavier; controlText.text = "Control : " + controlActualy.ToString(); }