public virtual void fight(short action, Creature attack, Creature target) { // GameDebug.Log("fight:"+ID); GameObject bulletObj = ResMgr.getSingleton().getBullet(); bulletObj.transform.position = this.transform.position; bullet b = bulletObj.GetComponent <bullet>(); b.Init(attack, target, (int)action); }
// Update is called once per frame void Update() { if (m_fShootCurCoolDown > 0) { m_fShootCurCoolDown -= Time.deltaTime; } if (m_fShootCurCoolDown <= 0 && Input.GetMouseButton(0)) { Vector3 dir = Target.position - Port.position; GameObject go = GameObject.Instantiate(BulletPfb); bullet bull = go.GetComponent <bullet>(); bull.transform.position = Port.position; bull.Init(dir); m_fShootCurCoolDown = ShootCoolDown; } }