void Start() { scene = SceneManager.GetActiveScene(); Debug.Log(scene.name); player = GetComponent <Player>(); attacker = GameObject.Find("PlayerCharacter/AttackBox").GetComponent <AttackCube>(); }
// assign controller to Controller2D and define gravity and jumping velocity // we use adjustable gravity and calculate our min and max jump velocity based on given gravity // max velocity is gravity's absolute value times timeToJumpApex // min velocity is square root of 2 times absolute gravity times minJumpHeight // default values are: // gravity -50 // maxJumpVelocity 20 // minJumpVelocity 10 void Start() { getInput = GetComponent <PlayerInput>(); controller = GetComponent <Controller2D>(); anim = GetComponent <Animator>(); atk = GameObject.Find("PlayerCharacter/AttackBox").GetComponent <AttackCube>(); gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2); // negative value maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); }
public static bool Prefix(AttackCube __instance, Collider c) { if (ItemRegistry.GetSingleton().HasEntry(GameScript.equippedIDs[0])) { ItemInfo weapon = ItemRegistry.GetSingleton().GetEntry(GameScript.equippedIDs[0]); PlayerScript player = __instance.gameObject.GetComponentInParent <PlayerScript>(); int num = 0; if (PlayerScript.berserkBool) { num = InstanceTracker.GameScript.GetFinalStat(1); } float[] array = new float[] { weapon.GetDamage(player) + num, MenuScript.player.transform.position.x }; if (weapon.TryCrit(player)) { if (GameScript.equippedIDs[0] == 373) { InstanceTracker.GameScript.RecoverHP(5); } else if (GameScript.equippedIDs[0] == 378) { GameScript.mana = GameScript.maxmana; InstanceTracker.GameScript.UpdateMana(); } __instance.GetComponent <AudioSource>().PlayOneShot(__instance.critSound, Menuu.soundLevel / 10f); UnityEngine.Object.Instantiate <GameObject>(__instance.crit, __instance.transform.position, Quaternion.identity); array[0] = weapon.MultiplyCrit(player, (int)array[0]); } if (GameScript.debugMode) { array[0] = 99999f; } if (Network.isServer) { c.gameObject.SendMessage("TD", array); } else { c.gameObject.GetComponent <NetworkView>().RPC("TD", RPCMode.Server, new object[] { array }); } return(false); } return(true); }
// Use this for initialization void Start() { obj = gameObject; anim = GetComponent <Animator>(); playerChar = GetComponent <Player>(); pc = GameObject.Find("PlayerCharacter"); if (!playerChar) { attackCube = GameObject.Find("Enemy1/AttackBox").GetComponent <AttackCube>(); playableChar = pc.GetComponent <Character>(); } if (playerChar) { spawnPoint = new Vector3(16, -5.7f, 0); pc.transform.position = spawnPoint; } }
void Start() { instance = this; firstTr = this.gameObject.transform; AddBodyPart(); // 머리를 제외한 꼬리부분 생성 //for (int i = 0; i < beginSize; i++) //{ // //BodyParts[i+1].localScale = BodyParts[i + 1].localScale - ((Vector3.one)*(i+1)*0.05f); //} //disTarget = targetTr.position - firstTr.position; cubeHead_Audio[0] = Resources.Load <AudioClip>("Whispering1"); cubeHead_Audio[1] = Resources.Load <AudioClip>("Whispering2"); cubeHead_Audio[2] = Resources.Load <AudioClip>("Whispering3"); }
void Start() { parentTr = this.transform.parent.transform; parentObj = parentTr.gameObject; dissolvedCube = parentObj.GetComponentInParent <AttackCube>(); }