// Use this for initialization void Start() { targetObject = null; increaseValue = (int)(GetComponentInParent <DragonBehaviour>().MAX_MOOD_VALUE * 0.02f); db = GetComponentInParent <DragonBehaviour>(); }
public override void OnInspectorGUI() { DragonBehaviour behaviour = (DragonBehaviour)target; var gameStates = behaviour.GetType().GetCustomAttributes(typeof(GameStateAttribute), true) .Cast <GameStateAttribute>().Select(attribute => attribute.GameState).ToList(); GUI.enabled = false; GUILayout.Space(10f); if (gameStates.Any()) { GUILayout.BeginHorizontal(); var gameStatesString = gameStates.Aggregate("", (current, gameState) => current + (gameState + ", ")); GUILayout.Label("GameStates", GUILayout.Width(EditorGUIUtility.labelWidth)); GUILayout.Label(gameStatesString.TrimEnd(',', ' ')); GUILayout.EndHorizontal(); } else { GUILayout.Label("No GameState Attributes", new GUIStyle { alignment = TextAnchor.MiddleCenter }); } GUILayout.Space(10f); GUI.enabled = true; DrawDefaultInspector(); }
// Start is called before the first frame update void Start() { m_refDragonBehaviour = GameObject.FindGameObjectWithTag("Player").gameObject.GetComponent <DragonBehaviour>(); if (m_refDragonBehaviour == null) { m_bIsError = true; Debug.LogError("[RaycastManager] DragonBehaviour not found. Functionality Halted. FIX ISSUE"); } }
void Start() { db = dragon.GetComponent <DragonBehaviour>(); for (int i = 0; i < 12; i++) { // 最初はハートは全て非表示 playerLoveRate[i].enabled = false; } frameCount = 0; }
private void OnTriggerEnter(Collider other) { // Debug.Log(_newPosition.position); if (other.GetComponent <WolfBehaviour>()) { WolfBehaviour wolf = other.GetComponent <WolfBehaviour>(); Instantiate(_dragonAI, _ghostPosition); wolf.SetState(new SplitState(wolf, _newPosition)); } else if (other.GetComponent <DragonBehaviour>()) { DragonBehaviour dragon = other.GetComponent <DragonBehaviour>(); Instantiate(_wolfAI, _ghostPosition); dragon.SetState(new SplitState(dragon, _newPosition)); } }
public void PerformAction(Tile tile, Player currentPlayer) { switch (currentAction) { case ActionType.House: SubstractBuildingCostFromPlayer(currentPlayer, currentAction); tile.PlaceHouse(currentPlayer); break; case ActionType.Road: SubstractBuildingCostFromPlayer(currentPlayer, currentAction); tile.PlaceRoad(currentPlayer); break; case ActionType.Trader: SubstractBuildingCostFromPlayer(currentPlayer, currentAction); GameObject trader = Instantiate(Resources.Load(Constants.prefabFolder + "Trader") as GameObject, tile.transform.position, Quaternion.identity); TraderBehaviour newTraderBehaviour = trader.AddComponent <TraderBehaviour>(); newTraderBehaviour.Initialize(trader, tile, currentPlayer); currentPlayer.addTrader(newTraderBehaviour); break; case ActionType.Dragon: // Get random tile from each border string option1 = "Tile" + 0 + "-" + Random.Range(0, GameManager.Instance.BoardSizeY); string option2 = "Tile" + (GameManager.Instance.BoardSizeX - 1) + "-" + Random.Range(0, GameManager.Instance.BoardSizeY); string option3 = "Tile" + Random.Range(0, GameManager.Instance.BoardSizeX) + "-" + 0; string option4 = "Tile" + Random.Range(0, GameManager.Instance.BoardSizeX) + "-" + (GameManager.Instance.BoardSizeY - 1); // Select one random tile string[] options = new string[4] { option1, option2, option3, option4 }; int index = Random.Range(0, options.Length); // Get position of boarder tile and set heigt for dragon to spawn Vector3 dragonSpawnPosition = GameObject.Find(options[index]).transform.position; dragonSpawnPosition.y = 5; // Spawn dragon over this border tile GameObject dragon = Instantiate(Resources.Load(Constants.prefabFolder + "Dragon") as GameObject, dragonSpawnPosition, Quaternion.identity); DragonBehaviour dragonBehaviour = dragon.AddComponent <DragonBehaviour>(); dragonBehaviour.Initialize(dragon, tile); // In case of DragonMadness gamemode, the game can launch attacks as well if (!(currentPlayer == null)) { currentPlayer.DecrementRemainingDragonAttacks(); } break; case ActionType.Destroy: tile.DestroyFeature(); break; default: Debug.Log("BuildingMode " + currentAction + " not implemented"); break; } }