//load our character public void loadChar() { if(File.Exists(Application.persistentDataPath + "/nocomply.heart")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/nocomply.heart", FileMode.Open); player = (PlayerChar)bf.Deserialize(file); file.Close(); } }
public void UseItem_menu(ItemData item, PlayerChar target) { var strtegy = CommandStrategy.GetStrategy(item); var friends = _playerDisplayers.Select(x => (BattleChar)x._mycharData).ToList(); var user = new PlayerChar(SaveDataController.Instance.GetDB_var <PlayerDB, SavedDBData_player>()[0]); strtegy.TurnAction(user, target, item, friends: friends); target.SyncData_This2Data(); SaveDataController.Instance.SetData <PlayerDB, SavedDBData_player>(target._PlayerData); }
public void GetCommandFromPlayer(string PName, string Command) //JEROME HERE ! Give me a player names and the command he sends ;-) { foreach (GameObject PlayerChar in m_listPlayer) { if (PlayerChar.GetComponent <PlayerCharacter>().PlayerName == PName) { PlayerChar.GetComponent <PlayerCharacter>().Move(Command); } } }
//load our character public void loadChar() { if (File.Exists(Application.persistentDataPath + "/nocomply.heart")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/nocomply.heart", FileMode.Open); player = (PlayerChar)bf.Deserialize(file); file.Close(); } }
private void MonsterAttacks(int obj) { if (this.tag != "Fokussed") { return; } PlayerChar.Verteidigen(obj); newLine("Enemy is attacking", false); newLine(PlayerChar._name + "'s HP: " + PlayerChar._hp + "/" + PlayerChar._maxhp, false); newLine("", true); // true cause we need that " < " icon. User can type in these lines StartCoroutine(GoToEnd()); }
// this is called when the object collides with another // need to check is trigger in collider on fireball for this to work // also need a rigid body component void OnTriggerEnter(Collider other) { PlayerChar player = other.GetComponent <PlayerChar>(); // check if the object is the player if (player != null) { player.Hurt(damage); } // destory the fireball Destroy(this.gameObject); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(instance); }
void Start() { m_PlayerChar = GetComponent<PlayerChar>(); m_Loaded = true; m_IsLoading = false; m_CrossbowShotEvent = FMODUnity.RuntimeManager.CreateInstance(m_CrossbowShotAudio); m_CrossbowShotEvent.start(); m_CrossbowShotEvent.getCue("KeyOff", out m_CrossbowCue); m_CrossbowShotEvent.getParameter("Reload", out m_CrossbowReload); ReadyRotation = Crossbow.transform.localRotation; ReloadRotation = ReadyRotation * Quaternion.AngleAxis(-20f, Vector3.right); }
/// <summary> /// プロパティを設定する /// </summary> /// <param name="attack">攻撃力</param> /// <param name="damageRate">ダメージの振れ幅</param> /// <param name="kind">攻撃の種類</param> /// <param name="parentPlayer">攻撃を出した親オブジェクト</param> public void SetProperties(int attack, float damageRate, AttackKind kind, PlayerChar parentPlayer, int sp = 0) { // 攻撃力を設定する this.attack = attack; // 攻撃力の振れ幅を設定する this.damageRate = damageRate; // 攻撃の種類を設定する this.attackKind = kind; // 攻撃の親オブジェクトを設定する this.parentPlayer = parentPlayer; // 加算されるSPの値を入れる this.sp = sp; }
public static Bed FirstFriendlyBedAtPos(Vector2i tilePos, PlayerChar pChar) { foreach (Unit u in pChar.TheMap.GetUnits(tilePos)) { if (u.MyType == Unit.Types.Bed && (u.MyGroupID == pChar.MyGroupID || u.MyGroup.IsAllyTo(pChar.MyGroup))) { return((Bed)u); } } return(null); }
public JobQualifications(PlayerChar owner, JobQualifications copyFrom) : this(owner) { MoveToPos_MaxDist.Value = copyFrom.MoveToPos_MaxDist; AcceptJob_Mining.Value = copyFrom.AcceptJob_Mining; AcceptJob_Build.Value = copyFrom.AcceptJob_Build; SleepWhen_EnergyBelow.Value = copyFrom.SleepWhen_EnergyBelow; SleepWhen_HealthBelow.Value = copyFrom.SleepWhen_HealthBelow; GrowingUpIsEmergency.Value = copyFrom.GrowingUpIsEmergency; AvoidEnemiesWhenPathing.Value = copyFrom.AvoidEnemiesWhenPathing; }
//check and return the object type hit by the raycast void ObjectCheck(GameObject objectHitByRayCast) { //check if object clicked is a tile //if (objectHitByRayCast.CompareTag("Tile")) //{ // MoveCharacter(objectHitByRayCast); //} //check if the object clicked is a player's character if (objectHitByRayCast.CompareTag("PlayerCharacter")) { myPlayerCharSelected = objectHitByRayCast; PlayerCharacterSelected(objectHitByRayCast); } }
void OnTriggerEnter2D(Collider2D hitInfo) { Debug.Log(hitInfo.name); PlayerChar player = hitInfo.GetComponent <PlayerChar>(); if (player == null) { if (hitInfo.name == "Enemy(Clone)") { Debug.Log("Hit!"); spawner.onKill(); } Instantiate(impactEffect, transform.position, transform.rotation); Destroy(gameObject); } }
public void Use() { switch (_mytype) { case PotionType.SmallHeal: PlayerChar.Heal(15); break; case PotionType.Heal: PlayerChar.Heal(25); break; case PotionType.BigHeal: PlayerChar.Heal(50); break; } }
public override void Interact() { if (isInteractable) { if (isLocked) { if (PlayerChar.GetComponent <PlayerControl>().HasItem(requiredItem.name)) { gameObject.SetActive(false); } } else { gameObject.SetActive(false); } } }
/// <summary> /// プレイヤーを全回復させる関数 /// </summary> /// <param name="player">回復させる対象</param> private void Venediction(GameObject player) { if (player) { // プレイヤーの情報をゲットする PlayerChar playerChar = player.GetComponent <PlayerChar>(); // プレイヤーが取得できれば if (playerChar) { // 他の誰かのHPを回復させる gameObject.GetPhotonView().RPC("Recover", player.GetPhotonView().owner, playerChar.GetPlayerData().MaxHP); // 処理が完了したので抜ける return; } } // 自分のHPを回復させる Recover(playerData.MaxHP); }
private string[] aptGetMethode(string _option, string[] _eingabe) { switch (_option) { case "update": BefehleErkennen("cd", new string[] { ".." }); BefehleErkennen("cd", new string[] { ".." }); _eingabe[0] = PlayerChar.LevelUp() + "\n"; _eingabe[0] += _currentDirectory.GetComponent <LevelUpSzene>().LevelUp(); break; default: _eingabe[0] = ""; break; } return(_eingabe); }
// Use this for initialization void Start() { characters = new GameObject[4]; for (int i = 0; i < 4; i++) { characters[i] = Instantiate(characterPrefab) as GameObject; characters[i].transform.parent = this.transform; Vector3 pos = new Vector3(); switch (i) { case (int)PlayerChar.X: pos = new Vector3(0, 0, -distanceFromCenter); break; case (int)PlayerChar.B: pos = new Vector3(0, 0, distanceFromCenter); break; case (int)PlayerChar.A: pos = new Vector3(distanceFromCenter, 0, 0); break; case (int)PlayerChar.Y: pos = new Vector3(-distanceFromCenter, 0, 0); break; } characters[i].transform.localPosition = pos; } characters[(int)PlayerChar.Y].renderer.sharedMaterial = GameManager.Instance.colors[(int)PlayerChar.Y]; characters[(int)PlayerChar.B].renderer.sharedMaterial = GameManager.Instance.colors[(int)PlayerChar.B]; characters[(int)PlayerChar.A].renderer.sharedMaterial = GameManager.Instance.colors[(int)PlayerChar.A]; characters[(int)PlayerChar.X].renderer.sharedMaterial = GameManager.Instance.colors[(int)PlayerChar.X]; currentCharacter = PlayerChar.B; goConfig = new GoTweenConfig(); StartCoroutine(CheckInput()); }
public void ReciveJob(int job, PhotonMessageInfo info) { PlayerChar playerChar = null; // ジョブの番号によって処理を分ける switch (job) { case 0: // アーチャーのコンポ―ネントを入れる playerChar = gameObject.AddComponent <Archer>(); // アーチャーのアニメーションを設定する anim.runtimeAnimatorController = archerAnimationController; break; case 1: // ウォーリアのコンポ―ネントを入れる playerChar = gameObject.AddComponent <Warrior>(); // ウォーリアのアニメーションを設定する anim.runtimeAnimatorController = warriorAnimationController; break; case 2: // ソーサラーのコンポーネントを入れる playerChar = gameObject.AddComponent <Sorcerer>(); // ソーサラーのアニメーションを設定する anim.runtimeAnimatorController = sorcererAnimationController; break; case 3: // モンクのコンポーネントを入れる playerChar = gameObject.AddComponent <Monk>(); // モンクのアニメーションを設定する anim.runtimeAnimatorController = monkAnimationController; break; } // 同期対象に追加する photonView.ObservedComponents.Add(playerChar); // レイヤーの0番を同期に設定する animView.SetLayerSynchronized(0, PhotonAnimatorView.SynchronizeType.Discrete); // 同期設定を行う animView.SetParameterSynchronized("RunFlag", PhotonAnimatorView.ParameterType.Bool, PhotonAnimatorView.SynchronizeType.Discrete); playerChar.GetPlayerData().job = job; }
//TODO: Stat for how to respond to enemies (attack if within distance, run if within distance, ignore), plus Stat<bool> for whether enemies are considered an emergency. public JobQualifications(PlayerChar owner) { UnityEngine.Assertions.Assert.IsTrue(owner != null); Owner = owner; MoveToPos_MaxDist = new Stat <int, JobQualifications>(this, int.MaxValue); AcceptJob_Mining = new Stat <bool, JobQualifications>(this, true); AcceptJob_Build = new Stat <bool, JobQualifications>(this, true); SleepWhen_EnergyBelow = new Stat <float, JobQualifications>(this, Consts.DefaultSeekBedEnergy); SleepWhen_HealthBelow = new Stat <float, JobQualifications>(this, Consts.DefaultSeekBedHealth); GrowingUpIsEmergency = new Stat <bool, JobQualifications>(this, false); AvoidEnemiesWhenPathing = new Stat <bool, JobQualifications>(this, true); }
//defines what happens when an object collides with a given spell public void OnCollisionEnter(Collision c) { Debug.Log("Anything!!??!!" + c.gameObject.name); if (c.gameObject.tag.Equals("Player")) { Debug.Log("Collision!!"); PlayerChar pc = c.gameObject.GetComponent("PlayerChar") as PlayerChar; //issues grabbing the playerchar from the gameobject pc.takeDamage(this.getDmg(), this); } else if (c.gameObject.tag == "Spell") //same as above { Spell s = c.gameObject.GetComponent("Spell") as Spell; //issues grabbing the playerchar from the gameobject s.versus(this); } else if (c.gameObject.tag == "SideWall") { kill(); } }
IEnumerator EndRotation(PlayerChar newChar) { if (canShoot) { canShoot = false; canRotate = true; currentCharacter = newChar; if (!root.isMoving) { Bullet tempBullet = Instantiate(bulletPrefab, gunPoint.position, gunPoint.rotation) as Bullet; tempBullet.ColorIndex = (int)currentCharacter; } yield return(new WaitForSeconds(shootingInterval)); canShoot = true; } yield return(null); }
public void Initialize(PlayScene scene) { mNoteSystem.Initialize(scene); mDoorSystem.Initialize(scene); mGameUIPage = scene.UIPage; mPlayerChar = scene.PlayerCharObj; NoteDeleteObj = scene.NoteDeleteObj; DDongViewObj = scene.DDongViewObj; mPlayerChar.Initialize(); InGameEffect_Slow = scene.InGameEffect_Slow; InGameEffect_Double = scene.InGameEffect_Double; InGameEffect_Revive = scene.InGameEffect_Revive; InGameEffect_Start = scene.InGameEffect_Start; // AdManager.Instance.RequestInterstitialAd(); // AdManager.Instance.RequestRewardBasedVideo(); }
public void Initialize(Ability selectedAbility, GameObject weaponHolder) // Initializing script by assigning values to the ability by pulling values f { attackingChar = gameObject; // Detects object this script is attached to and sets it as the attacker to be passed to the ability itself. ability = selectedAbility; // Dictates activated ability, should be referencing a specific script and accessing its values through this.. // myButtonImage = GetComponent<Image>(); // Component for the ui aspect. getAudio = GetComponent <PlayerChar>(); // abilitySource = getAudio.musicSource; //Starts Audio // myButtonImage.sprite = ability.aSprite; // Sprite for the GUI element. // darkMask.sprite = ability.aSprite; coolDownDuration = ability.aBaseCoolDown; // Cooldown pulled from ability basecooldown value; ability.attacker = attackingChar; ability.Initialize(weaponHolder); // Sets the spawn point of the ability as the object weaponholder. AbilityReady(); // Sets ability as ready. }
void LevelUpAction(PlayerChar target, int up, List <SkillDBData> addSkillList) { if (up <= 0) { return; } var plName = target._displayName; var nowlevel = target._PlayerData._level; var beforelevel = nowlevel - up; var log = ""; if (up == 1) { log += $"{plName}はレベルが{nowlevel}に上がった<{plName}0>!\n"; } else if (up > 1) { log += $"{plName}はレベルが{beforelevel}から{nowlevel}に上がった<{plName}0>!\n"; } foreach (var skill in addSkillList) { log += $"{plName}は{skill._Data._skillName}を習得した\n"; } AddDisplayText(log); //表示の更新 var targetDisp = _charParamDisplyer.GetParamDisplayer(target); if (targetDisp == null) { return; } _battleTextDisplayer.AddTextAction(target._displayName + "0", () => { target.SyncData_Data2This(); targetDisp.SyncDisply(); }); }
// Update is called once per frame void Update() { // プレイヤーのスクリプトが未割当の場合 if (!playerChar) { // プレイヤーを探し出す playerChar = StaticMethods.FindGameObjectWithPhotonNetworkIDAndObjectTag(PhotonNetwork.player.ID, "Player").GetComponent <PlayerChar>(); } // スキルの番号が押された時 if (Input.GetKeyDown(KeyCode.Alpha1 + skillPaletteNumber)) { // スキルのクールタイム発生フラグが立っていなければ if (!skillCoolTimeFlag) { // スキルを使用する if (playerChar.UseSkill(skillID, SkillControl.GetSkill(skillID))) { // クールタイムの発生 SetSkillIcon.GenerationSkillCoolTime(skillID); skillCoolTimeFlag = true; } } } }
//private float Timer = 2f; void Start() { m_Navigator = GetComponent<NavMeshAgent>(); m_Player = GameObject.FindGameObjectWithTag("Player"); m_PlayerInfo = Player.GetComponent<PlayerChar>(); m_Animations = GetComponent<Animator>(); m_FootstepState = FMODUnity.RuntimeManager.CreateInstance(m_FootstepEvent); m_VoiceAttack = FMODUnity.RuntimeManager.CreateInstance(m_VoiceAttackEvent); m_VoiceDeath = FMODUnity.RuntimeManager.CreateInstance(m_VoiceDeathEvent); m_VoiceHit = FMODUnity.RuntimeManager.CreateInstance(m_VoiceHitEvent); m_VoiceIdle = FMODUnity.RuntimeManager.CreateInstance(m_VoiceIdleEvent); }
// Use this for initialization void Start() { m_PlayerChar = GetComponent<PlayerChar>(); m_IsFlying = true; m_BoltBody = GetComponent<Rigidbody>(); }
// Use this for initialization void Start() { player = FindObjectOfType <PlayerChar>(); offset = new Vector3(5, 2.8f, -10); }
// Use this for initialization void Start() { m_PlayerChar = GetComponent<PlayerChar>(); }
// Use this for initialization void Start() { player = FindObjectOfType <PlayerChar>(); }
void Awake() { Instance = this; }
// Use this for initialization void Start() { player = FindObjectOfType <PlayerChar>(); box2.enabled = false; }
//call this immediately after creating this object public void prepWall(PlayerChar p) { this.p = p; facingRight = true; }
public Girl(Texture2D sprite, Map map, Game1 game, PlayerChar targetChar) : base(sprite, map) { this.PhysicalContact += FoundMe; this.gameref = game; this.targetChar = targetChar; this.Position = new Vector2(7, 64 + 27); this.emotionstate = new EmotionState(new eSpace(-.2, -.2, .4, .3, -.1, .3, 0, 0)); eSpace.Fear = -.2; eSpace.Anger = -.2; eSpace.Sadness = .4; eSpace.Joy = .3; eSpace.Disgust = -.1; eSpace.Trust = .3; addEmotion(eSpace, 100); shader = gameref.Content.Load<Effect>("shaders/cavernShader"); /* DialogState state = new DialogState(0, "Eeek! You found me!"); state.addResponse("Ok...",1); state.addResponse("Go Away Kitty...",2); state.addResponse("Meow meow meow mix.. !",2); state.addResponse("I found who?", 3); state.addResponse("Lets get out of here.", 4); state.addResponse("Yes I did", 5); this.Dialog.addState(state); state = new DialogState(1, "Lets get out of here"); state.addResponse("Good idea",-1); state.addResponse("But I dont wanna!",11); this.Dialog.addState(state); state = new DialogState(2, "Ummm... who you callin kitty. Freak."); state.addResponse("Thats what she said", 6); state.addResponse("Sorry, slip of tounge. Moving on...", 7); state.addResponse("Well then what are you?", 3); state.addResponse("Your ears sure are pointy\n enough for it.", 8); this.Dialog.addState(state); state = new DialogState(3, "Me. Why are you asking that?"); state.addResponse("Because I can",8); state.addResponse("Your answers suck", 9); state.addResponse("Because I'm a dick", 10); state.addResponse("*meow*", 2); this.Dialog.addState(state); state = new DialogState(4, "Good idea. Follow me!"); state.addResponse("ok!",-1); state.addResponse("*me0w*", 2); this.Dialog.addState(state); state = new DialogState(5, "So what now?"); state.addResponse("Pie",12); state.addResponse("Rawr",13); state.addResponse("lets go",4); this.Dialog.addState(state); state = new DialogState(6, "Your mom"); state.addResponse("Kitty!",2); state.addResponse("Your Dad", 14); state.addResponse("Umm... ", 1); this.Dialog.addState(state); state = new DialogState(7, "So says the freak"); state.addResponse("Says the one with the cat", 14); state.addResponse("Owww", 1); this.Dialog.addState(state); state = new DialogState(8, "Dick"); state.addResponse("I am", 10); state.addResponse("Change of Subject, lets leave.", 4); state.addResponse("You know who else wants one?", 6); this.Dialog.addState(state); state = new DialogState(9, "Says the one asking these shitty ass questions"); state.addResponse("Cant help it, Im scripted", 15); state.addResponse("Says the one... Kitty!", 2); state.addResponse("Ill stop the questions if you\n show me the way out?", 4); this.Dialog.addState(state); state = new DialogState(10, "Well you sure aint got one!"); state.addResponse("Burrrn",6); state.addResponse("Says the kitty.", 2); state.addResponse("New Topic, leave?", 4); this.Dialog.addState(state); state = new DialogState(11, "Too Bad!"); state.addResponse("Awwww", 5); state.addResponse("Pie", 12); this.Dialog.addState(state); state = new DialogState(12, "Pie? Where?"); state.addResponse("Thats what she said", 8); state.addResponse("I ate it", 8); state.addResponse("The Mad Robot said to eat it.", 7); this.Dialog.addState(state); state = new DialogState(13, "Ooh! Tigers!"); state.addResponse("And Kitties!", 2); state.addResponse("Another good reasion to put some\n distance between us and\n this cavern.", 4); this.Dialog.addState(state); state = new DialogState(14,"Your gross"); state.addResponse("No you are", 7); state.addResponse("But I dont wanna be!", 10); this.Dialog.addState(state); state = new DialogState(15, "Then pick the right answer!"); state.addResponse("AlphaNumeric!", 8); state.addResponse("Lets go...", 2); this.Dialog.addState(state); */ emotionstate = new EmotionState(); }
//call this immediately after creating this object public void prepSlash(PlayerChar p, GameObject g) { this.p = p; this.g = g; facingRight = true; }
/// <summary> /// プレイヤーのデータを格納する /// </summary> /// <param name="playerChar">プレイヤーのデータ</param> public void SetPlayerChar(PlayerChar playerChar) { Debug.Log("SetPlayerChar(" + playerChar.GetPlayerData().name + ")"); this.playerChar = playerChar; Start(); }