// note: ProjectileContainers contain simple dummy values, which are // then replaced by data that's passed-in via projectile objects void Init(Weapon incoming) { weapon = incoming; weaponType = incoming.weaponType; alreadyCollided = false; iconSprite = incoming.iconSprite; title = incoming.title; damage = incoming.damage; hp = incoming.hp; rateOfAttack = incoming.rateOfAttack; spriteRenderer.sprite = incoming.projectileSprite; speed = incoming.speed; maxDistance = incoming.maxDistance; lob = incoming.lob; lobGravity = incoming.lobGravity; fadeIn = incoming.fadeIn; collider2D.enabled = true; origin = new Vector3(transform.position.x, transform.position.y, transform.position.z); // initialize animation controller if projectile is animated if (incoming.GetComponent <Weapon>().animatedProjectile) { anim = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate (Resources.Load(("AnimControllers/Projectiles/" + incoming.name + "_0"), typeof(RuntimeAnimatorController))); animator.runtimeAnimatorController = anim; animator.speed = .5f; } InvokeRepeating("CheckDistanceTraveled", 1, 0.3F); }
void Start() { player = GameObject.Find("Player"); self = gameObject; if (player == null) { Debug.LogError("Player Object must be named \"Player\"."); } self.AddComponent <EnemyAudio>(); self.AddComponent <CapsuleCollider>(); self.AddComponent <AudioSource>(); self.AddComponent <NavMeshAgent>(); animator = GetComponent <Animator>(); navMeshAgent = GetComponent <NavMeshAgent>(); capsuleCollider = GetComponent <CapsuleCollider>(); enemyAudio = GetComponent <EnemyAudio>(); self.tag = "enemy"; animator.runtimeAnimatorController = RuntimeAnimatorController.Instantiate( Resources.Load("Animations/Attack") ) as RuntimeAnimatorController; navMeshAgent.speed = 1; capsuleCollider.isTrigger = false; capsuleCollider.radius = 0.8f; }
// Use this for initialization void Start() { string resourcePath = "Animation/" + SelectedCharacter.firstPlayer + "/" + SelectedCharacter.firstPlayer + "AnimatorController"; Debug.Log("Load resource: " + resourcePath); RuntimeAnimatorController Player1Animation = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(resourcePath, typeof(RuntimeAnimatorController))); player1.GetComponent <Animator>().runtimeAnimatorController = Player1Animation; resourcePath = "Textures/" + SelectedCharacter.firstPlayer + "/spritesheet" + SelectedCharacter.firstPlayer; Debug.Log("Load resource: " + resourcePath); Sprite Player1Sprite = (Sprite)Resources.Load(resourcePath, typeof(Sprite)); player1.GetComponent <SpriteRenderer>().sprite = Player1Sprite; player1.GetComponent <Animator> ().SetInteger("WalkState", 1); resourcePath = "Animation/" + SelectedCharacter.secondPlayer + "/" + SelectedCharacter.secondPlayer + "AnimatorController"; Debug.Log("Load resource: " + resourcePath); RuntimeAnimatorController Player2Animation = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(resourcePath, typeof(RuntimeAnimatorController))); player2.GetComponent <Animator>().runtimeAnimatorController = Player2Animation; resourcePath = "Textures/" + SelectedCharacter.secondPlayer + "/spritesheet" + SelectedCharacter.secondPlayer; Debug.Log("Load resource: " + resourcePath); Sprite Player2Sprite = (Sprite)Resources.Load(resourcePath, typeof(Sprite)); player2.GetComponent <SpriteRenderer>().sprite = Player2Sprite; player2.GetComponent <Animator> ().SetInteger("WalkState", -1); }
// Use this for initialization void Start() { Animator Anim = gameObject.GetComponent <Animator>(); Anim.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("TestAnimationController")); }
/// <summary> /// データを読み込んでbuilderとしてListに組み込みます /// </summary> void loadBuilder() { var max = MaxId; for (int i = 0; i < max; i++) { ShootWeaponBuilder builder = new ShootWeaponBuilder(); //各値を読み込み builder.Id = int.Parse(getRawParam(i, "ID")); builder.Name = getRawParam(i, "Name"); builder.Ammo = int.Parse(getRawParam(i, "Ammo")); builder.Damage = float.Parse(getRawParam(i, "Damage")); builder.FireRate = float.Parse(getRawParam(i, "FireRate")); builder.NeedStr = int.Parse(getRawParam(i, "NeedSTR")); builder.Range = float.Parse(getRawParam(i, "Range")); builder.Recoil = float.Parse(getRawParam(i, "Recoil")); builder.Weight = float.Parse(getRawParam(i, "Weight")); builder.ZoomRate = float.Parse(getRawParam(i, "ZoomRate")); builder.IsAutomatic = (getRawParam(i, "isAutomatic") == "TRUE"); builder.ReloadSec = float.Parse(getRawParam(i, "ReloadSec")); builder.WeaponPrefab = (GameObject)Resources.Load("Prefabs/" + getRawParam(i, "ObjectName")); builder.WeaponAnim = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Animators/" + getRawParam(i, "AnimName"))); builders.Add(builder); } }
public Pool(string casa) { soldados = new List <GameObject> (); GameObject soldado = ((GameObject)Resources.Load(casa + "/Soldado", typeof(GameObject))); soldado.transform.position = Vector3.zero; for (int i = 0; i < 30; i++) { GameObject aux = GameObject.Instantiate(soldado); aux.GetComponent <Animator>().runtimeAnimatorController = RuntimeAnimatorController.Instantiate(Resources.Load(casa + "/SoldadoC")) as RuntimeAnimatorController; soldados.Add(aux); } caballeros = new List <GameObject> (); GameObject caballero = ((GameObject)Resources.Load(casa + "/Caballero", typeof(GameObject))); caballero.transform.position = Vector3.zero; for (int i = 0; i < 20; i++) { GameObject aux = GameObject.Instantiate(caballero); aux.GetComponent <Animator>().runtimeAnimatorController = RuntimeAnimatorController.Instantiate(Resources.Load(casa + "/CaballeroC")) as RuntimeAnimatorController; caballeros.Add(aux); } dragones = new List <GameObject> (); GameObject dragon = ((GameObject)Resources.Load(casa + "/Dragon", typeof(GameObject))); dragon.transform.position = Vector3.zero; for (int i = 0; i < 10; i++) { GameObject aux = GameObject.Instantiate(dragon); aux.GetComponent <Animator>().runtimeAnimatorController = RuntimeAnimatorController.Instantiate(Resources.Load(casa + "/DragonC")) as RuntimeAnimatorController; dragones.Add(aux); } }
void Start() { gameObject.AddComponent <EnemyAudio>(); gameObject.AddComponent <CapsuleCollider>(); gameObject.AddComponent <AudioSource>(); gameObject.AddComponent <NavMeshAgent>(); player = GameObject.Find("Player"); animator = GetComponent <Animator>(); navMeshAgent = GetComponent <NavMeshAgent>(); capsuleCollider = GetComponent <CapsuleCollider>(); enemyAudio = GetComponent <EnemyAudio>(); gameObject.tag = "enemy"; animator.runtimeAnimatorController = RuntimeAnimatorController.Instantiate( Resources.Load("Animations/Attack") ) as RuntimeAnimatorController; navMeshAgent.speed = 1; capsuleCollider.radius = 0.4f; capsuleCollider.height = 2f; capsuleCollider.center = new Vector3(0, 0.7f, 0); if (player == null) { Debug.LogError("Player Object must be named \"Player\"."); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { Animator anim = animator.gameObject.transform.GetChild(0).gameObject.GetComponent <Animator>(); RuntimeAnimatorController contr = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(theEvent); anim.runtimeAnimatorController = contr; }
protected override void Awake() { base.Awake(); movementPath = new ConcurrentQueue <Graph.Node>(); setMovementCoroutine(); setAttackCoroutine(); animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Animations/WizardAnimController")); }
protected override void Awake() { base.Awake(); movementPath = new ConcurrentQueue <Graph.Node>(); this.atkAnimStr = sprayAtkAnimStr; // defaut attack is spray setMovementCoroutine(); setAttackCoroutine(); animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Animations/OliAnimatorController")); }
public void LoadAssetBundle() { for (int i = 0; i < assetsToRead.Count; i++) { byte[] src = File.ReadAllBytes(assetsToRead[i].bundle); AssetBundle b = AssetBundle.CreateFromMemoryImmediate(src); for (int j = 0; j < assetsToRead[i].assets.Count; j++) { string assetName = assetsToRead[i].assets[j]; string ext = assetName.Substring(assetName.LastIndexOf('.')); if (ext == ".fbx") { GameObject go = b.LoadAsset <GameObject>(assetName); GameObject inst = GameObject.Instantiate(go); gameobjects.Add(inst); Debug.Log(inst); } else if (ext == ".png" || ext == ".tga") { Texture t = b.LoadAsset <Texture>(assetName); this.textures.Add(t); } else if (ext == ".shader") { //Shader s = b.LoadAsset<Shader>(assetName); //this.shaders.Add(s); } else if (ext == ".txt") { TextAsset t = b.LoadAsset <TextAsset>(assetName); this.textAssets.Add(t); } else if (ext == ".mat") { Material mat = b.LoadAsset <Material>(assetName); this.materials.Add(mat); } else if (ext == ".controller") { RuntimeAnimatorController anim = b.LoadAsset <RuntimeAnimatorController>(assetName); this.animation.Add(anim); Animator a = gameobjects[0].GetComponent <Animator>(); if (a != null) { a.runtimeAnimatorController = RuntimeAnimatorController.Instantiate <RuntimeAnimatorController>(anim); } } } b.Unload(false); } }
// Update is called once per frame void Awake() { events = Resources.LoadAll("Animations/rdmEm"); Animator anim = gameObject.GetComponent <Animator>(); Shuffle(events); RuntimeAnimatorController contr = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(events[0]); anim.runtimeAnimatorController = contr; eventNum++; }
public static void SetAnimator(GameObject go, string resourceController) { Object controller = Resources.Load(resourceController); if (controller != null) { Animator animator = go.GetComponent <Animator>(); animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(controller); animator.speed = Config.AnimationSpeedWorldObjects; animator.applyRootMotion = false; } }
public void AssignBehavior(GameObject obj, AnimationTypes behavior) { if (behavior == AnimationTypes.None) { var rb = obj.AddComponent <Rigidbody>(); rb.useGravity = true; } else { var animator = obj.AddComponent <Animator>(); animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(GetAnimationResourceLoadString(behavior), typeof(RuntimeAnimatorController))); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (!shuffled) { events = Resources.LoadAll(path); Shuffle(events); shuffled = true; } Animator anim = animator.gameObject.transform.GetChild(0).gameObject.GetComponent <Animator>(); RuntimeAnimatorController contr = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(events[eventNum]); anim.runtimeAnimatorController = contr; eventNum++; }
public void Init(RuntimeAnimatorController controller) { gameObject.layer = (int)Util.GO.Layer.Players; gameObject.transform.localPosition = Config.PlayerCenter; gameObject.transform.localRotation = Quaternion.identity; gameObject.transform.localScale = Config.ScaleObject; animator = gameObject.GetComponent <Animator>(); if (animator != null && controller != null) { animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(controller); animator.speed = Config.AnimationSpeedWorldObjects; animator.cullingMode = AnimatorCullingMode.AlwaysAnimate; animator.applyRootMotion = false; } }
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.name == "ButtomWall") { ani = this.GetComponent <Animator>(); ani.runtimeAnimatorController = RuntimeAnimatorController.Instantiate(Resources.Load("Ani/AlienWalk")) as RuntimeAnimatorController; GetComponent <Rigidbody2D>().velocity = Vector2.zero; GetComponent <Rigidbody2D>().gravityScale = 0; GetComponent <Rigidbody2D>().velocity = new Vector2(2, 0); } else if (collision.gameObject.name == "RightWall") { GameManager.coin += 1; Destroy(this.gameObject); SavedAlien = Instantiate(Resources.Load("Prefabs/SavedAlien"), new Vector2(Random.Range(540, 680), Random.Range(45, 145)), Quaternion.identity) as GameObject; SavedAlien.transform.SetParent(GameObject.Find("SavedThings").transform); } }
// Update is called once per frame void Update () { if(player_1 == null){ player_1 = GameObject.Find("Player1").GetComponent<Player1>(); } if(player_2 == null){ player_2 = GameObject.Find("Player2").GetComponent<Player2>(); } if(anim1 == null){ // Load player 1's character (default = Dennis) if(savedSelections.selected_p1 == "S. Racks"){ anim1 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/SRacks", typeof(RuntimeAnimatorController))); }else if(savedSelections.selected_p1 == "SH1-V4"){ anim1 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/SH1V4", typeof(RuntimeAnimatorController))); }else if(savedSelections.selected_p1 == "Colonel Topspin"){ anim1 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/ColonelTopspin", typeof(RuntimeAnimatorController))); }else{ anim1 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/Dennis", typeof(RuntimeAnimatorController))); } }else{ // Set the animator controller player_1._animator.runtimeAnimatorController = anim1; } if(anim2 == null){ // Load player 2's character (default = S. Racks) if(savedSelections.selected_p2 == "Dennis"){ anim2 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/Dennis", typeof(RuntimeAnimatorController))); }else if(savedSelections.selected_p2 == "SH1-V4"){ anim2 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/SH1V4", typeof(RuntimeAnimatorController))); }else if(savedSelections.selected_p2 == "Colonel Topspin"){ anim2 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/ColonelTopspin", typeof(RuntimeAnimatorController))); }else{ anim2 = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Anims/SRacks", typeof(RuntimeAnimatorController))); } }else{ // Set the animator controller player_2._animator.runtimeAnimatorController = anim2; } }
private void Awake() { animator = transform.gameObject.AddComponent <Animator>(); animator.runtimeAnimatorController = RuntimeAnimatorController.Instantiate(Resources.Load("animations/CraftableItemController")) as RuntimeAnimatorController; if (xLength * zLength < 1) { Debug.LogError("Can't have non positive xLength or zLength!"); xLength = 1; zLength = 1; } var collider = transform.gameObject.AddComponent <BoxCollider>(); collider.isTrigger = true; collider.size = new Vector3(xLength, 0.2f, zLength); collider.center = new Vector3(0, 0.1f, 0); fixOffset(); translateControls = this.gameObject.AddComponent <PositionArrowsController> (); translateControls.setSize(xLength, zLength); }
protected void testLoadAnimatorControllerPrefab() { LoadParam param; param = Ctx.m_instance.m_poolSys.newObject <LoadParam>(); LocalFileSys.modifyLoadParam("Animation/Scene/Control.prefab", param); param.m_loadNeedCoroutine = false; param.m_resNeedCoroutine = false; PrefabResItem bbb = Ctx.m_instance.m_resLoadMgr.getAndLoad(param) as PrefabResItem; Ctx.m_instance.m_poolSys.deleteObj(param); GameObject _go = UtilApi.createGameObject("AnimatorController"); Animator animator = _go.AddComponent <Animator>(); GameObject _insObj = bbb.InstantiateObject(""); RuntimeAnimatorController controlCom = _insObj.GetComponent <Animator>().runtimeAnimatorController; //_insObj.GetComponent<Animator>().runtimeAnimatorController = null; RuntimeAnimatorController copyCom = RuntimeAnimatorController.Instantiate(controlCom); animator.runtimeAnimatorController = copyCom; //UtilApi.SetParent(_insObj, _go); UtilApi.Destroy(_insObj); }
private void Start() { VrmControllingObjectNumber++; vrmObjectNumber = VrmControllingObjectNumber; animation = GetComponent <Animation>(); animator = GetComponent <Animator>(); animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate( Resources.Load("AnimatorControllers/MixamoAnimatorController")); animator.updateMode = AnimatorUpdateMode.UnscaledTime; openAnimationKey = Animator.StringToHash("Entry"); animator.Play(openAnimationKey, 0, currentAnimationTime); animation.playAutomatically = true; transform.Rotate(0f, 180f, 0f); animatorControllerDropdownGameObject = GameObject.Find("AnimatorControllerDropdown"); animatorControllerDropdown = animatorControllerDropdownGameObject.GetComponent <TMP_Dropdown>(); previousAnimatorControllerDrowdownValue = animatorControllerDropdown.value; ChangedAnimatorControllerDropdownValue(); animationSpeedRateTextGameObject = GameObject.Find("AnimationSpeedRateText"); animationSpeedRateText = animationSpeedRateTextGameObject.GetComponent <TextMeshProUGUI>(); //ヨーロッパ圏での小数点入力の際に必要であるようです。 System.Globalization.CultureInfo.CurrentCulture = new System.Globalization.CultureInfo("en-us"); }
void Start() { #region UI 表示物 fight0 = GameObject.Find(ThisSceneDto.GameObjFight0); fight0.GetComponent <Text>().text = ThisSceneDto.CharacterToFightMessage[(int)CommonScript.UseCharacters[PlayerIndex.Player1]]; fight1 = GameObject.Find(ThisSceneDto.GameObjFight1); resign0 = GameObject.Find(ThisSceneDto.GameObjResign0); resign0.SetActive(false); this.PlayerDTOs = new Dictionary <PlayerIndex, PlayerDto>() { { PlayerIndex.Player1, new PlayerDto( // bar1のRectTransformコンポーネントをキャッシュ GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player1][(int)GameObjectTypeIndex.Bar]).GetComponent <RectTransform>(), // 名前 GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player1][(int)GameObjectTypeIndex.Name]).GetComponent <Text>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player1][(int)GameObjectTypeIndex.Value]).GetComponent <Text>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player1][(int)GameObjectTypeIndex.Player]), new GameObject[] { GameObject.Find("ResultP0_0"), GameObject.Find("ResultP0_1") }, GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player1][(int)GameObjectTypeIndex.Turn]).GetComponent <Text>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player1][(int)GameObjectTypeIndex.Turn]).GetComponent <Outline>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player1][(int)GameObjectTypeIndex.Time]).GetComponent <Text>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player1][(int)GameObjectTypeIndex.Time]).GetComponent <Outline>() ) }, { PlayerIndex.Player2, new PlayerDto( GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player2][(int)GameObjectTypeIndex.Bar]).GetComponent <RectTransform>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player2][(int)GameObjectTypeIndex.Name]).GetComponent <Text>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player2][(int)GameObjectTypeIndex.Value]).GetComponent <Text>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player2][(int)GameObjectTypeIndex.Player]), new GameObject[] { GameObject.Find("ResultP1_0"), GameObject.Find("ResultP1_1") }, GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player2][(int)GameObjectTypeIndex.Turn]).GetComponent <Text>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player2][(int)GameObjectTypeIndex.Turn]).GetComponent <Outline>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player2][(int)GameObjectTypeIndex.Time]).GetComponent <Text>(), GameObject.Find(ThisSceneDto.GameObjectPaths[PlayerIndex.Player2][(int)GameObjectTypeIndex.Time]).GetComponent <Outline>() ) }, }; this.PublicPlayerDTOs = new Dictionary <PlayerIndex, PublicPlayerDto>() { { PlayerIndex.Player1, new PublicPlayerDto() }, { PlayerIndex.Player2, new PublicPlayerDto() }, }; #endregion #region 選択キャラクター foreach (var player in PlayerIndexes.All) { CharacterIndex character = CommonScript.UseCharacters[player]; this.PlayerDTOs[player].PlayerName.text = ThisSceneDto.CharacterToNameRoma[(int)character]; // アニメーター this.PlayerDTOs[player].PlayerCharAnimetor.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(ThisSceneDto.CharacterToAnimationController[(int)character])); } #endregion // 初期化。 InitTime(); this.PublicPlayerDTOs[PlayerIndex.Player1].AttackPower = 0.0f; this.PublicPlayerDTOs[PlayerIndex.Player2].AttackPower = 0.0f; //StateExTable.Instance.InsertAllStates(); #region リセット(配列やスプライト等の初期設定が終わってから) ReadyingTime = 0; SetTeban(PlayerIndex.Player1); // コンピューターかどうか。 foreach (var player in PlayerIndexes.All) { this.PlayerDTOs[player].PlayerCharScript.isComputer = CommonScript.computerFlags[player]; } #endregion }
private void ChangedAnimatorControllerDropdownValue() { switch (animatorControllerDropdown.value) { case 0: animator.runtimeAnimatorController = null; break; case 1: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerArmStretching")); break; case 2: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerCards")); break; case 3: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerDancing")); break; case 4: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerHapplyIdle")); break; case 5: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerOrcIdle")); break; case 6: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerSitting")); break; case 7: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerSittingClap")); break; case 8: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerSittingThumbsUp")); break; case 9: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerSittingYell")); break; case 10: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerStandingWBriefcaseIdle")); break; case 11: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerTaunt")); break; case 12: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerTextingWhileStanding")); break; case 13: animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("AnimatorControllers/AnimatorControllerThankful")); break; default: break; } }
void LoadRangedAnimator() { _animator.runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Animation/PlayerRangedStance", typeof(RuntimeAnimatorController))); currentlyInRangeMode = true; currentlyInMeleeMode = false; }
void Start() { platformFriableGrounded = false; speed = 1; t = new GameObject().transform; tFin = new GameObject().transform; t.localPosition = new Vector3(x, y, 0); tFin.localPosition = new Vector3(fin_x, fin_y, 0); posDeb = t.localPosition; posFin = tFin.localPosition; posSuivante = posFin; if (transform.name.Contains("platform_1")) { transform.GetChild(0).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite>(PlayerPrefs.GetString("Saison")); transform.GetChild(0).GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(PlayerPrefs.GetString("Saison") + "Friable")); } if (transform.name.Contains("platform_2")) { transform.GetChild(0).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite>(PlayerPrefs.GetString("Saison") + "Left"); transform.GetChild(0).GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(PlayerPrefs.GetString("Saison") + "FriableLeft")); transform.GetChild(1).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite>(PlayerPrefs.GetString("Saison") + "Right"); transform.GetChild(1).GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(PlayerPrefs.GetString("Saison") + "FriableRight")); } if (transform.name.Contains("platform_3")) { transform.GetChild(0).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite>(PlayerPrefs.GetString("Saison") + "Left"); transform.GetChild(0).GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(PlayerPrefs.GetString("Saison") + "FriableLeft")); transform.GetChild(1).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite>(PlayerPrefs.GetString("Saison") + "Mid"); transform.GetChild(1).GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(PlayerPrefs.GetString("Saison") + "FriableMid")); transform.GetChild(2).GetComponent <SpriteRenderer> ().sprite = Resources.Load <Sprite>(PlayerPrefs.GetString("Saison") + "Right"); transform.GetChild(2).GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(PlayerPrefs.GetString("Saison") + "FriableRight")); } if (friable) { trigger.ForEach(delegate(GameObject obj) { obj.SetActive(true); }); } }
public void TriggerAfterStomp() { GameObject interacted = interactedShape.transform.GetChild(0).gameObject; GameObject newObject; switch (interacted.name) { case "Sphere": interacted.GetComponent <Animator>().SetBool("stomped", false); break; case "Cube": interacted.GetComponent <Animator>().SetBool("stomped", false); newObject = GameObject.CreatePrimitive(PrimitiveType.Cube); newObject.name = "Plank"; newObject.transform.parent = interacted.transform.parent; newObject.transform.localPosition = Vector3.zero; newObject.transform.localScale = new Vector3(1f, 0.01f, 1f); newObject.transform.eulerAngles = new Vector3(0f, 0f, -90f); newObject.GetComponent <Renderer>().material = Resources.Load("Materials/Material_002", typeof(Material)) as Material; newObject.AddComponent <PlayerShape>(); newObject.AddComponent <Animator>(); newObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Animations/Plank/Plank")); Destroy(interacted); break; case "Plank": interacted.GetComponent <Animator>().SetBool("stomped", false); break; } }
/** * Special trigger for the cube's stomp, which needs to handle the stomped shapes reaction (animation, creation of shapes, * destruction of other shapes, etc...) */ public void TriggerStomp() { GameObject interacted = interactedShape.transform.GetChild(0).gameObject; int i = 0; switch (interacted.name) { case "Sphere": interacted.GetComponent <Animator>().SetBool("stomped", true); break; case "Cube": interacted.GetComponent <Animator>().SetBool("stomped", true); break; case "Plank": interacted.GetComponent <Animator>().SetBool("stomped", true); break; case "Pyramid": List <Vector3> freeTiles = Pathing.NeighbouringFree(interacted.transform.parent.position); if (freeTiles.Count >= 2) { while (i < 2) { GameObject parent = new GameObject("Player"); GameObject miniCube = GameObject.CreatePrimitive(PrimitiveType.Cube); parent.tag = "Unit"; parent.transform.position = freeTiles[i]; miniCube.name = "Mini Cube"; miniCube.transform.parent = parent.transform; miniCube.transform.eulerAngles = new Vector3(0f, 0f, 0f); miniCube.transform.localPosition = new Vector3(0f, -0.25f, 0f); miniCube.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); miniCube.GetComponent <Renderer>().material = Resources.Load("Materials/Material_002", typeof(Material)) as Material; miniCube.AddComponent <PlayerShape>(); miniCube.AddComponent <Animator>(); miniCube.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("Animations/Mini Cube/Mini Cube")); i++; } GameObject.Find("Main Camera").GetComponent <UIManager>().ClearUI(); Destroy(transform.parent.gameObject); } break; } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { if (!PopupManager.firstweaponfound) { StartCoroutine(GameObject.FindGameObjectWithTag("PopupManager").GetComponent <PopupManager>().firstweapon()); PopupManager.firstweaponfound = true; } playersWeapon = switchWeaponsScript.gameObject.transform.GetChild(0).gameObject; //switchWeaponsScript.pickaxeActive = false; if (SwitchWeapons.pickaxeActive) { switchWeaponsScript.PutAwayPickaxe(); SwitchWeapons.pickaxeActive = false; } //gameObject.transform.parent = playersWeapon.transform.parent; //gameObject.transform.rotation = playersWeapon.transform.rotation; //gameObject.transform.position = playersWeapon.transform.position; //Destroy(playersWeapon); //gameObject.transform.SetAsFirstSibling(); //weaponZeroRW = switchWeaponsScript.weaponZero; //weaponOneRW = switchWeaponsScript.weaponOne; if (gameObject.name == "spear(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = speartransform.transform.rotation; gameObject.transform.position = speartransform.transform.position; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("spear", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); newWeapon = gameObject; newWeapon.GetComponent <WeaponStats>().weaponType = 7; //switchWeaponsScript.ChangeWeapon(); //switchWeaponsScript.ChangeWeapon(); // weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; //gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "lowpolysword(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = playersWeapon.transform.rotation; gameObject.transform.position = playersWeapon.transform.position; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("sword1proto2", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); newWeapon = gameObject; newWeapon.GetComponent <WeaponStats>().weaponType = 1; //switchWeaponsScript.ChangeWeapon(); //switchWeaponsScript.ChangeWeapon(); // weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; //gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "lowpolymace(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = maceTransform.rotation; gameObject.transform.position = maceTransform.position; gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("lowpolymace", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); gameObject.GetComponent <WeaponStats>().weaponType = 2; //weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; // gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "lowpolyhammer(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = playersWeapon.transform.rotation; gameObject.transform.position = playersWeapon.transform.position; gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("lowpolyhammer", typeof(RuntimeAnimatorController))); //keepweapon = switchWeaponsScript.weaponOne; Destroy(playersWeapon); gameObject.GetComponent <WeaponStats>().weaponType = 3; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; // gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "battleaxe(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = battleaxeTransform.transform.rotation; gameObject.transform.position = battleaxeTransform.transform.position; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("battleaxe", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); newWeapon = gameObject; newWeapon.GetComponent <WeaponStats>().weaponType = 4; //switchWeaponsScript.ChangeWeapon(); //switchWeaponsScript.ChangeWeapon(); // weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; //gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "scythe(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = scytheTransform.transform.rotation; gameObject.transform.position = scytheTransform.transform.position; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("scythe", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); newWeapon = gameObject; newWeapon.GetComponent <WeaponStats>().weaponType = 5; //switchWeaponsScript.ChangeWeapon(); //switchWeaponsScript.ChangeWeapon(); // weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; //gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "lowpolypistol(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = gunTransform.transform.rotation; gameObject.transform.position = gunTransform.transform.position; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("lowpolypistol", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); newWeapon = gameObject; newWeapon.GetComponent <WeaponStats>().weaponType = 6; //switchWeaponsScript.ChangeWeapon(); //switchWeaponsScript.ChangeWeapon(); // weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; //gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "hoe(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = hoeTransform.transform.rotation; gameObject.transform.position = hoeTransform.transform.position; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("hoe", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); newWeapon = gameObject; newWeapon.GetComponent <WeaponStats>().weaponType = 8; //switchWeaponsScript.ChangeWeapon(); //switchWeaponsScript.ChangeWeapon(); // weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; //gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "fork(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = gunTransform.transform.rotation; gameObject.transform.position = gunTransform.transform.position; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("fork", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); newWeapon = gameObject; newWeapon.GetComponent <WeaponStats>().weaponType = 9; //switchWeaponsScript.ChangeWeapon(); //switchWeaponsScript.ChangeWeapon(); // weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; //gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "dualdaggers(Clone)") { gameObject.transform.parent = playersWeapon.transform.parent; gameObject.transform.rotation = dualdaggersTransform.transform.rotation; gameObject.transform.position = dualdaggersTransform.transform.position; gameObject.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); gameObject.transform.Find("dagger1").GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("dagger1", typeof(RuntimeAnimatorController))); gameObject.transform.Find("dagger2").GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("dagger2", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); newWeapon = gameObject; newWeapon.GetComponent <WeaponStats>().weaponType = 11; //switchWeaponsScript.ChangeWeapon(); //switchWeaponsScript.ChangeWeapon(); // weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = gameObject; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; //gameObject.AddComponent<keepWeapon>(); Destroy(thiss); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } if (gameObject.name == "hammerandsickledisplay(Clone)") { GameObject sickle = Instantiate(workingHammerandSickle, gameObject.transform.position, gameObject.transform.rotation) as GameObject; sickle.transform.parent = playersWeapon.transform.parent; sickle.transform.rotation = hammerandsickleTransform.transform.rotation; sickle.transform.position = hammerandsickleTransform.transform.position; sickle.transform.SetAsFirstSibling(); //switchWeaponsScript.RepopulateArray(); sickle.gameObject.GetComponent <Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load("hammerandsickle", typeof(RuntimeAnimatorController))); Destroy(playersWeapon); newWeapon = sickle; newWeapon.GetComponent <WeaponStats>().weaponType = 12; //switchWeaponsScript.ChangeWeapon(); //switchWeaponsScript.ChangeWeapon(); // weaponsarray[1] = weaponsarray[0]; //keepweapon = switchWeaponsScript.weaponOne; switchWeaponsScript.weaponZero = sickle; switchWeaponsScript.weaponOne = weaponcontainer.transform.GetChild(1).gameObject; switchWeaponsScript.ChangeWeapon(); switchWeaponsScript.fixSlot1 = true; SwitchWeapons.weaponZeroActive = true; //gameObject.AddComponent<keepWeapon>(); Destroy(gameObject); //switchWeaponsScript.weaponOne = keepweapon; //weaponsarray[1] = weaponcontainer.transform.GetChild(1).gameObject; } } }
void Start() { #region UI 表示物 fight0 = GameObject.Find(SceneCommon.GAMEOBJ_FIGHT0); fight0.GetComponent <Text>().text = SceneCommon.Character_to_fightMessage[(int)CommonScript.Player_to_useCharacter[(int)PlayerIndex.Player1]]; fight1 = GameObject.Find(SceneCommon.GAMEOBJ_FIGHT1); resign0 = GameObject.Find(SceneCommon.GAMEOBJ_RESIGN0); resign0.SetActive(false); player_to_name = new[] { GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player1, (int)GameobjectIndex.Name]).GetComponent <Text>(), GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player2, (int)GameobjectIndex.Name]).GetComponent <Text>() }; player_to_value = new[] { GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player1, (int)GameobjectIndex.Value]).GetComponent <Text>(), GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player2, (int)GameobjectIndex.Value]).GetComponent <Text>() }; #endregion #region Internal variable 内部変数 player_to_winCount = new[] { 0, 0 }; #endregion #region 選択キャラクター player_to_playerChar = new[] { GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player1, (int)GameobjectIndex.Player]), GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player2, (int)GameobjectIndex.Player]) }; player_to_charScript = new[] { player_to_playerChar[(int)PlayerIndex.Player1].GetComponent <Main_PlayerScript>(), player_to_playerChar[(int)PlayerIndex.Player2].GetComponent <Main_PlayerScript>() }; player_to_anime = new [] { player_to_playerChar[(int)PlayerIndex.Player1].GetComponent <Animator>(), player_to_playerChar[(int)PlayerIndex.Player2].GetComponent <Animator>() }; for (int iPlayer = (int)PlayerIndex.Player1; iPlayer < (int)PlayerIndex.Num; iPlayer++) { CharacterIndex character = CommonScript.Player_to_useCharacter[iPlayer]; // 名前 player_to_name[iPlayer].text = SceneCommon.Character_to_nameRoma[(int)character]; // アニメーター player_to_anime[iPlayer].runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(Resources.Load(SceneCommon.Character_to_animationController[(int)character])); } #endregion //bar1のRectTransformコンポーネントをキャッシュ player_to_barTransform = new[] { GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player1, (int)GameobjectIndex.Bar]).GetComponent <RectTransform>(), GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player2, (int)GameobjectIndex.Bar]).GetComponent <RectTransform>() }; #region 時間制限 player_to_turn = new [] { GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player1, (int)GameobjectIndex.Turn]).GetComponent <Text>(), GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player2, (int)GameobjectIndex.Turn]).GetComponent <Text>() }; player_to_time = new [] { GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player1, (int)GameobjectIndex.Time]).GetComponent <Text>(), GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player2, (int)GameobjectIndex.Time]).GetComponent <Text>() }; player_to_turnOutline = new [] { GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player1, (int)GameobjectIndex.Turn]).GetComponent <Outline>(), GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player2, (int)GameobjectIndex.Turn]).GetComponent <Outline>() }; player_to_timeOutline = new [] { GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player1, (int)GameobjectIndex.Time]).GetComponent <Outline>(), GameObject.Find(SceneCommon.PlayerAndGameobject_to_path[(int)PlayerIndex.Player2, (int)GameobjectIndex.Time]).GetComponent <Outline>() }; InitTime(); #endregion #region 攻撃力 player_to_attackPower = new float[] { 0.0f, 0.0f }; #endregion #region ラウンド playerAndRound_to_result = new GameObject[, ] { { GameObject.Find("ResultP0_0"), GameObject.Find("ResultP0_1") }, { GameObject.Find("ResultP1_0"), GameObject.Find("ResultP1_1") }, }; for (int iPlayer = (int)PlayerIndex.Player1; iPlayer < (int)PlayerIndex.Num; iPlayer++) { for (int iRound = 0; iRound < 2; iRound++) { playerAndRound_to_result[iPlayer, iRound].SetActive(false); } } #endregion //StateExTable.Instance.InsertAllStates(); #region リセット(配列やスプライト等の初期設定が終わってから) ReadyingTime = 0; SetTeban(PlayerIndex.Player1); // コンピューターかどうか。 for (int iPlayer = (int)PlayerIndex.Player1; iPlayer < (int)PlayerIndex.Num; iPlayer++) { player_to_charScript[iPlayer].isComputer = CommonScript.Player_to_computer[iPlayer]; } #endregion }
public void StartAnim() { onAnimator.runtimeAnimatorController = (RuntimeAnimatorController) RuntimeAnimatorController.Instantiate(Resources.Load("04.Image/Trap/" + Animname, typeof(RuntimeAnimatorController))); }