public void Skill(Fix64Vector2 actionplace) { Fix64Vector2 singplace = (Fix64Vector2)(Vector2)transform.position; Fix64Vector2 skilldirection = actionplace - singplace; float realdistance = Mathf.Min((float)skilldirection.Length(), maxdistance); if (realdistance <= 0.51) { return; } //半径小于自身半径时不施法 GetComponent <DoSkill>().BeforeSkill(); currentcooldown = 0; skillavaliable = false; bulletspeed = realdistance * 1.13f / (maxtime - 0.5f); Fix64Vector2 fp1 = skilldirection.normalized().CCWTurn(Fix64.Pi / (Fix64)4); DoFire(singplace, fp1 * (Fix64)bulletspeed, false); fp1 = fp1.CCWTurn(-Fix64.Pi / (Fix64)2); DoFire(singplace, fp1 * (Fix64)bulletspeed, true); }
public void Skill(Fix64Vector2 actionplace) { Fix64Vector2 singplace = (Fix64Vector2)GetComponent <Rigidbody2D>().position; Fix64Vector2 skilldirection = actionplace - singplace; GetComponent <DoSkill>().BeforeSkill(); Fix64 mdfx = (Fix64)maxdistance; if (skilldirection.Length() > mdfx) { actionplace = singplace + skilldirection.normalized() * mdfx; } GameObject MyRock = Instantiate(TheStar, actionplace.ToV2(), Quaternion.identity); MyRock.GetComponent <StarScript>().sender = gameObject; MyRock.GetComponent <StarScript>().powerpers = powerpersecond; MyRock.GetComponent <CountdownScript>().maxtime = maxtime; currentcooldown = 0; skillavaliable = false; }
public void Skill(Fix64Vector2 actionplace) { Fix64Vector2 singplace = (Fix64Vector2)GetComponent <Rigidbody2D>().position; Fix64Vector2 skilldirection = actionplace - singplace; float realdistance = Mathf.Min((float)skilldirection.Length(), maxdistance); if (realdistance <= 0.6) { return; } //半径小于自身半径时不施法 else { GetComponent <DoSkill>().BeforeSkill(); MS.controllable = true; currentcooldown = 0; skillavaliable = false; float TimeR2 = (float)((Fix64)realdistance / (Fix64)SpeedR2); gameObject.GetComponent <ColliderScript>().SetPower(pushPower, pushTime, pushDamage); gameObject.GetComponent <ColliderScript>().StartKick(TimeR2); gameObject.GetComponent <RBScript>().GetPushed(skilldirection.normalized() * (Fix64)SpeedR2, TimeR2); } }