protected override bool OnCast(Entity source) { var proj = ChakramProjectile.Fire(source.GameObject); Effects.SpellCastEffect.Display(proj.Position, proj.Rotation); return(true); }
// Update is called once per frame void Update() { //Mouse Position in 3D world Ray r = Camera.main.ScreenPointToRay(Input.mousePosition); Debug.DrawRay(r.origin, r.direction * 100); if (Physics.Raycast(r, out hit, 100)) { mousePos = hit.point; } Vector3 dir = hit.point - player.transform.position; dir.y = 0; if (!inTether) { player.model.rotation = Quaternion.LookRotation(dir.normalized); } if (Input.GetMouseButtonDown(0) && !InAttack && !chakramThrown && !inTether) { anim.SetTrigger("Attack"); } if (Input.GetMouseButtonDown(1) && !chakramThrown && !inTether) { GameObject g = Instantiate(chakramBullet, (transform.position + Vector3.up) + dir.normalized * 0.2f, Quaternion.identity); ChakramProjectile p = g.GetComponent <ChakramProjectile>(); p.Initiate(player.transform, dir.normalized); p.OnComeback.AddListener(ChakramReturned); p.MODE = BOOMERANGMODE; p.mode = boomode; p.Speed = boomVal.speed; p.throwTime = boomVal.time; p.angleSpeed1 = boomVal.angVel1; p.angleSpeed2 = boomVal.angVel2; p.yspeed = boomVal.yVel; chakramThrown = true; BoomerangGFX.SetActive(false); } if (Input.GetKeyDown(KeyCode.E) && !chakramThrown && !inTether) { StartCoroutine(TetherAttack()); } bool slowmo = Input.GetKey(KeyCode.Tab); if (slowmo) { Time.timeScale = 0.25f; m_Volume.weight = Mathf.MoveTowards(m_Volume.weight, 1, 0.1f); } else { Time.timeScale = 1f; m_Volume.weight = Mathf.MoveTowards(m_Volume.weight, 0, 0.1f); } }