Inheritance: MonoBehaviour
Example #1
0
 // Use this for initialization
 void Start()
 {
     bM_script = GameObject.Find("BoardManager").GetComponent<BoardManager>();
     change = false;
     Debug.Log("AddArrow");
     bM_script.ArrowList.Add(gameObject);
 }
Example #2
0
    void Awake()
    {
        sound= GetComponent<AudioSource>();
        bSoundOn= GameObject.Find ("sound_on").GetComponent<Button>();
        bSoundOff= GameObject.Find ("sound_off").GetComponent<Button>();

        if (PlayerPrefs.GetInt ("mute", 0) == 0) {
            bSoundOff.gameObject.SetActive (false);
        } else {
            bSoundOn.gameObject.SetActive (false);
        }
        mute = PlayerPrefs.GetInt ("mute")==1;
        if (mute)
            sound.mute = true;

        blackTransparent = new Color32 (40,40,40,0);
        white= new Color32 (255,255,255,255);

        boardScript=GetComponent<BoardManager>();
        boardScript.createBoard (8);
        boardScript.InstatiatePolygons (15,1,4);

        //StartCoroutine("initialize");
        title.position = new Vector3 (title.position.x,title.position.y-(Screen.height/4)+50);
    }
Example #3
0
 void OnEnable()
 {
     Debug.Log("Enable");
     boardScript = GetComponent<BoardManager>();
     enemiesMoving = false;
     InitGame();
 }
Example #4
0
	public void init(int tileType, BoardManager board) {
		this.board = board;
		turnCount = 0;
		tileObj = GameObject.CreatePrimitive(PrimitiveType.Quad);
		tileMod = tileObj.AddComponent<TileModel>();
		tileMod.init(this, type);
	}
Example #5
0
 void Awake()
 {
     if (instance == null)
     instance = this;
     else if (instance != this)
     Destroy (gameObject);
 }
Example #6
0
 // Use this for initialization
 void Start()
 {
     bM = GameObject.Find("BoardManager");
     bM_script = bM.GetComponent<BoardManager>();
     bM_script.CountDownList.Add(gameObject);
     bM_script.CleanUpList.Add(gameObject);
 }
Example #7
0
    private int level = 1; //Current level number, expressed in game as "Day 1".

    #endregion Fields

    #region Methods

    //Awake is always called before any Start functions
    void Awake()
    {
        //Sets this to not be destroyed when reloading scene
        DontDestroyOnLoad (gameObject);

        //Check if instance already exists
        if (instance == null) {

            //if not, set instance to this
            instance = gameObject.GetComponent<GameManager>();
        }
            //If instance already exists and it's not this:
        else if (instance != gameObject.GetComponent<GameManager>())
        {

            //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
            Destroy (gameObject);
        }

        //Get a component reference to the attached BoardManager script
        boardScript = GetComponent<BoardManager> ();

        //Call the InitGame function to initialize the first level
        if (shouldCreatePlayers)
        {
            InitGame();
        }
    }
Example #8
0
    //Awake is always called before any Start functions
    public void Awake()
    {
        //Check if instance already exists
            if (instance == null)

                //if not, set instance to this
                instance = this;

            //If instance already exists and it's not this:
            else if (instance != this)

                //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
                Destroy(gameObject);

            //Sets this to not be destroyed when reloading scene
            DontDestroyOnLoad(gameObject);

            //Assign enemies to a new List of Enemy objects.
            enemies = new List<Enemy>();

            //Get a component reference to the attached BoardManager script
            boardScript = GetComponent<BoardManager>();

            //Call the InitGame function to initialize the first level
            if (!firtTimeLoad) {
                InitGame();
            }

            //Call the canva menuPrincipale for the first time loading the scene
            if (firtTimeLoad) {
                menuprincipal = (GameObject)Instantiate(Resources.Load("Prefabs/CanvasMenuPrincipal"));
                menuprincipal.SetActive (true);
                firtTimeLoad = false;
            }
    }
Example #9
0
    //Awake is always called before any Start functions
    void Awake()
    {
        //Check if instance already exists
            if (instance == null)

                //if not, set instance to this
                instance = this;

            //If instance already exists and it's not this:
            else if (instance != this)

                //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
                Destroy(gameObject);

            //Sets this to not be destroyed when reloading scene
            DontDestroyOnLoad(gameObject);

            //Assign enemies to a new List of Enemy objects.
            //enemies = new List<Enemy>();
            //transform.name.Replace("(clone)", "").Trim();

            //Get a component reference to the attached BoardManager script
            boardScript = GetComponent<BoardManager>();

            //Call the InitGame function to initialize the first level
            InitGame();

            ////////////my test for block
            //CreateLevelFromJavatoXml block = new CreateLevelFromJavatoXml();
    }
Example #10
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null) instance = this;
     else if (instance != null) Destroy(gameObject);
     DontDestroyOnLoad (gameObject);
     boardScript = GetComponent<BoardManager> ();
     InitGame ();
 }
Example #11
0
    void Start()
    {
        boardManagerScript = FindObjectOfType<BoardManager>();
        pickUp = (GameObject)Resources.Load("Prefabs/Pick Ups/Temporary");	// Change from temp Prefab in future.
        pickUpList = new List<PickUpItem>();
        totalPickUps = 0;

        createPickUps();
    }
Example #12
0
    void Awake()
    {
        currentState = Config.STARTED;
        if (instance == null)
            instance = this;
        else if (instance != this)
            Destroy (gameObject);

        boardScript = GetComponent<BoardManager> ();
    }
Example #13
0
    void Awake()
    {
        if (Instance != null) {
            DestroyImmediate(gameObject);
        } else {
            Instance = this;
        }

        boardElements = new List<BoardElement>(FindObjectsOfType<BoardElement>());
    }
Example #14
0
 void Awake(){
     if (instance == null){
         instance = this;
     }else{
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
     enemies = new List<Enemy>();
     boardScript = GetComponent<BoardManager>();
     InitGame();
 }
Example #15
0
	void Start () {
		gameManager = GameObject.FindGameObjectWithTag ("GameManager") as GameObject;

		if (gameManager == null) {
			Debug.LogError("Tag GameManager object with the GameManager tag");
		}

		boardManager = gameManager.GetComponent<BoardManager> ();

		uiManager = gameManager.GetComponent<UIManager> ();
	}
Example #16
0
	void Awake () {
    if (instance == null) {
      instance = this;
    } else if (instance != this) {
      Destroy(gameObject);
    }

    DontDestroyOnLoad(gameObject);
    boardManager = GetComponent<BoardManager>();
    InitGame();
	}
Example #17
0
    void Awake()
    {
        // Enforce singleton-ness
        if (instance == null)
            instance = this;
        else if (instance != this)
            Destroy (gameObject);

        boardManager = GetComponent<BoardManager> ();
        boardManager.SetupScene ();
    }
Example #18
0
	void initGame() {
		boardScript = GetComponent<BoardManager>();
		doingSetup = true;
		//levelImage = GameObject.Find ("levelImage");
		//levelText = GameObject.Find ("levelText").GetComponent<Text>();
		//levelText.text = "Day " + level;
		//levelImage.SetActive (true);
		//Invoke("hideLevelImage", levelStartDelay);

		boardScript.setupScene(level);
	}
Example #19
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
         instance = this;
     else if (instance != this)
         Destroy(gameObject); //singletoooooon
     DontDestroyOnLoad(gameObject);
     enemies = new List<Enemy>();
     boardScript = GetComponent<BoardManager>();
     InitLevel();
 }
    void Awake()
    {
        if(instance==null) instance = this;
        else if(instance!=this) Destroy(gameObject);

        DontDestroyOnLoad(gameObject);//dont destroy on load new scene!

        enemies = new List<Enemy>();

        boardScript = GetComponent<BoardManager>();
        InitGame();
    }
Example #21
0
    public void gameOver()
    {
        level = 1;
        GameObject[] objects = GameObject.FindObjectsOfType<GameObject> ();
        foreach (GameObject o in objects) {
            if(!(o.name.Contains("GameManager") ||o.name.Contains ("SoundManager") || o.name.Contains("EmptyObject")||o.name.Contains("Event")||o.name.Contains("Light")))
                Destroy(o);
        }

        boardScript = GetComponent<BoardManager> ();
        turnScript = GetComponent<TurnManager> ();
        gridScript = GetComponent<Grid> ();
    }
Example #22
0
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
            instance = this;
        else if (instance != this)
            Destroy (gameObject);

        DontDestroyOnLoad (gameObject);

        boardScript = GetComponent<BoardManager> ();
        turnScript = GetComponent<TurnManager> ();
        gridScript = GetComponent<Grid> ();
    }
	void Awake()
    {
        if (instance == null)  // if no previous manager
        {
            instance = this;
        } else if (instance != this) // if manager already exists dont make another
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);// makes this not die when a new scene is loaded
        boardScript = GetComponent<BoardManager>();
        InitGame();
    }
Example #24
0
 public void init(BoardManager boardMan, Tile[,] board) {
     emptyTiles = new List<Tile>();
     bm = boardMan;
     gemFolder = new GameObject();
     gemFolder.name = "Gems";        // The name of a game object is visible in the hHerarchy pane.
     gems = new List<Gem>();
     gemType = 1;
     for (int x=0; x<board.GetLength(0); x++) {
         for (int y=0; y<board.GetLength(1); y++) {
             emptyTiles.Add(board[x, y]);
         }
     }
 }
	void Awake() 
	{
		if (instance = null) 
		{
			instance = this;
		}
		else if (instance != null)
		{
			Destroy(gameObject);
		}

		boardScript = GetComponent<BoardManager> ();
		Init ();
	}
Example #26
0
    // Use this for initialization
    void Awake()
    {
        // Make a singleton
        if (instance == null)
            instance = this;
        else if (instance != this)
            Destroy(gameObject);

        // We want to retain this object through the scenes to preserve data like the score
        DontDestroyOnLoad(gameObject);

        boardScript = GetComponent<BoardManager>();
        InitGame();
    }
Example #27
0
 public void Init()
 {
     if (!_init)
     {
         currentRoomX = 0;
         currentRoomY = 0;
         _nextRoomPos = Vector2.zero;
         _player = FindObjectOfType<Player>();
         _camera = FindObjectOfType<Camera>();
         _camera_behaviour = _camera.GetComponentInChildren<Camera_behaviour>();
         _boardManager = FindObjectOfType<GameController>().boardManager;
         _rooms = new Dictionary<Vector2, Room>();
         _init = true;
     }
 }
Example #28
0
    // Update is called once per frame
    void Start () {
		gameManager = GameObject.FindGameObjectWithTag ("GameManager") as GameObject;
		
		if (gameManager == null) {
			Debug.LogError("Tag GameManager object with the GameManager tag");
		}
		
		boardManager = gameManager.GetComponent<BoardManager> () as BoardManager;
		
		uiManager = gameManager.GetComponent<UIManager> () as UIManager;

        winScreen = _winScreen.GetComponent<WinScreen>() as WinScreen;

		Current = View.MainMenu;
	}
Example #29
0
	void Awake ()
	{
		// Make sure there exists exactly one GameManager and no more (singleton)
		if (instance == null)
			instance = this;
		else if (instance != this)
			Destroy (gameObject);

		// Keep the GameManager between scenes/levels
		DontDestroyOnLoad (gameObject);

		_enemies = new List<Enemy> ();

		boardScript = GetComponent<BoardManager> ();
		InitGame ();
	}
Example #30
0
	void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            // Don't end up with multiple GameManagers
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        enemies = new List<Enemy>();
        boardManager = GetComponent<BoardManager>();
        InitGame();
	}
 void Awake()
 {
     boardScript = GetComponent <BoardManager>();
     InitGame();
 }
Example #32
0
 // Use this for initialization
 void Start()
 {
     board = FindObjectOfType <BoardManager>();
     StartCoroutine(MainCoroutine());
 }
Example #33
0
 /// <summary>
 /// This function is used to determine if an ability can be activated at a specific location for the desired board.
 /// This function should not be used to modify any properties of the ability and should treat itself as const
 /// </summary>
 /// <param name="controller">Player trying to activate this ability</param>
 /// <param name="board">The board which they are trying to act upon</param>
 /// <param name="worldPos">World positiion of click</param>
 /// <param name="tileIndex">Index of selected tile</param>
 /// <returns>If ability can be used</returns>
 public virtual bool canUseAbilityHere(PlayerController controller, BoardManager board, Vector3 worldPos, Vector3Int tileIndex)
 {
     return(true);
 }
Example #34
0
    /// <summary>
    /// horses can move in L shape moves
    /// the main restrictions are:
    /// The positions of the pieces (must be inside the board)
    /// can not go into a own piece
    /// </summary>
    /// <returns>bidemensional boolean array with the possible moves</returns>
    public override bool[,] PossibleMove(BoardManager instance)
    {
        bool[,] possibleMovesMap = new bool[8, 8];
        ChessPiece enemyPiece;

        //diagonal leftup+left
        if (CurrentX - 2 >= 0 && CurrentZ + 1 <= 7)
        {
            enemyPiece = instance.chessPieces[CurrentX - 2, CurrentZ + 1];
            if (enemyPiece == null)
            {
                possibleMovesMap[CurrentX - 2, CurrentZ + 1] = true;
            }
            else
            {
                if (isWhite != enemyPiece.isWhite)
                {
                    possibleMovesMap[CurrentX - 2, CurrentZ + 1] = true;
                }
            }
        }
        //diagonal leftup+up
        if (CurrentX - 1 >= 0 && CurrentZ + 2 <= 7)
        {
            enemyPiece = instance.chessPieces[CurrentX - 1, CurrentZ + 2];
            if (enemyPiece == null)
            {
                possibleMovesMap[CurrentX - 1, CurrentZ + 2] = true;
            }
            else
            {
                if (isWhite != enemyPiece.isWhite)
                {
                    possibleMovesMap[CurrentX - 1, CurrentZ + 2] = true;
                }
            }
        }
        //diagonal leftdown+left
        if (CurrentX - 2 >= 0 && CurrentZ - 1 >= 0)
        {
            enemyPiece = instance.chessPieces[CurrentX - 2, CurrentZ - 1];
            if (enemyPiece == null)
            {
                possibleMovesMap[CurrentX - 2, CurrentZ - 1] = true;
            }
            else
            {
                if (isWhite != enemyPiece.isWhite)
                {
                    possibleMovesMap[CurrentX - 2, CurrentZ - 1] = true;
                }
            }
        }
        //diagonal leftdown+down
        if (CurrentX - 1 >= 0 && CurrentZ - 2 >= 0)
        {
            enemyPiece = instance.chessPieces[CurrentX - 1, CurrentZ - 2];
            if (enemyPiece == null)
            {
                possibleMovesMap[CurrentX - 1, CurrentZ - 2] = true;
            }
            else
            {
                if (isWhite != enemyPiece.isWhite)
                {
                    possibleMovesMap[CurrentX - 1, CurrentZ - 2] = true;
                }
            }
        }
        //diagonal rightup+right
        if (CurrentX + 2 <= 7 && CurrentZ + 1 <= 7)
        {
            enemyPiece = instance.chessPieces[CurrentX + 2, CurrentZ + 1];
            if (enemyPiece == null)
            {
                possibleMovesMap[CurrentX + 2, CurrentZ + 1] = true;
            }
            else
            {
                if (isWhite != enemyPiece.isWhite)
                {
                    possibleMovesMap[CurrentX + 2, CurrentZ + 1] = true;
                }
            }
        }
        //diagonal rightup+up
        if (CurrentX + 1 <= 7 && CurrentZ + 2 <= 7)
        {
            enemyPiece = instance.chessPieces[CurrentX + 1, CurrentZ + 2];
            if (enemyPiece == null)
            {
                possibleMovesMap[CurrentX + 1, CurrentZ + 2] = true;
            }
            else
            {
                if (isWhite != enemyPiece.isWhite)
                {
                    possibleMovesMap[CurrentX + 1, CurrentZ + 2] = true;
                }
            }
        }
        //diagonal rightdown+right
        if (CurrentX + 2 <= 7 && CurrentZ - 1 > 0)
        {
            enemyPiece = instance.chessPieces[CurrentX + 2, CurrentZ - 1];
            if (enemyPiece == null)
            {
                possibleMovesMap[CurrentX + 2, CurrentZ - 1] = true;
            }
            else
            {
                if (isWhite != enemyPiece.isWhite)
                {
                    possibleMovesMap[CurrentX + 2, CurrentZ - 1] = true;
                }
            }
        }
        //diagonal rightdown+down
        if (CurrentX + 1 <= 7 && CurrentZ - 2 > 0)
        {
            enemyPiece = instance.chessPieces[CurrentX + 1, CurrentZ - 2];
            if (enemyPiece == null)
            {
                possibleMovesMap[CurrentX + 1, CurrentZ - 2] = true;
            }
            else
            {
                if (isWhite != enemyPiece.isWhite)
                {
                    possibleMovesMap[CurrentX + 1, CurrentZ - 2] = true;
                }
            }
        }
        return(possibleMovesMap);
    }
Example #35
0
 // Use this for initialization
 void Start()
 {
     boardManager = FindObjectOfType <BoardManager>();
     stateManager = FindObjectOfType <StateManager>();
 }
    // Use this for initialization
    void Start()
    {
        boardManager = GameObject.Find("BoardManager").GetComponent <BoardManager>();

        StartCoroutine(CoroutineIntroduction());
    }
Example #37
0
 void Start()
 {
     BoardManager = GetComponent <BoardManager>();
     InitGame();
 }
Example #38
0
 void Start()
 {
     BoardManager = gameObject.AddComponent <BoardManager>();
 }
Example #39
0
 public IPhase getNextPhase()
 {
     return(BoardManager.getInstance().getEndPhase());
 }
Example #40
0
 public abstract int PlaceBoard(BoardManager boardManager, int gold);
Example #41
0
 // Use this for initialization
 void Awake()
 {
     board = FindObjectOfType <BoardManager> ();
     DetachChildrenfromParent();
 }
 /// <summary>
 /// cancle按钮单击回调
 /// </summary>
 public void CancelButtonClick()
 {
     BoardManager.Instance().SwitchShowBoard(BoardManager.BoardShow.NONE);
     Hide();
 }
Example #43
0
 private void Awake()
 {
     Instance = this;
 }
Example #44
0
 /// <summary>
 /// Finds a new target for the entity to move/explorer towards.
 /// </summary>
 /// <param name="currentPos">The current position of the entity</param>
 private void GenerateNewDestination(Vector2Int currentPos)
 {
     m_goalCoordinates = BoardManager.GetMap().GetRandomFloorTile();
     m_dStarLite.RunDStarLite(currentPos, m_goalCoordinates);
 }
 public void step(GameUnitEntity entity, BoardManager board)
 {
     rootNode.step(entity, board);
 }
Example #46
0
 private void Start()
 {
     _board       = GameObject.Find("GameBoard").GetComponent <BoardManager>();
     _gameManager = GameObject.Find("GameManager").GetComponent <GameManager>();
 }
Example #47
0
    public IEnumerator fire(Vector3 pos, Vector3 target)
    {
        BoardManager grid = (BoardManager)FindObjectOfType(typeof(BoardManager));
        tileData     tile;

        if (target.y == pos.y)
        {
            int y = (int)Mathf.Round(pos.y / 0.75f);
            if (target.x > pos.x)
            {
                int i;
                for (i = (int)Mathf.Floor(pos.x + 1.0f); i < grid.getCols(); i++)
                {
                    tile = (grid.objects[i, y].GetComponent(typeof(tileData)) as tileData);
                    if (tile.city)
                    {
                        //animation
                        grid.damageCity(damage);
                        i = 100;
                    }
                    else if (tile.blocked)
                    {
                        i = 100;
                        //run animation
                    }
                    else if (tile.enemy != null)
                    {
                        //animation
                        tile.enemy.damage(damage);
                        i = 100;
                    }
                    else if (tile.tank != null)
                    {
                        //animation
                        tile.tank.damage(damage);
                        i = 100;
                    }
                }
                if (i != 100)
                {
                    //miss animation
                }
                else
                {
                    //play audio
                }
            }
            else
            {
                int i;
                for (i = (int)Mathf.Floor(pos.x - 1.0f); i >= 0; i--)
                {
                    tile = (grid.objects[i, y].GetComponent(typeof(tileData)) as tileData);
                    if (tile.city)
                    {
                        //animation
                        grid.damageCity(damage);
                        i = -100;
                    }
                    else if (tile.blocked)
                    {
                        i = -100;
                        //run animation
                    }
                    else if (tile.enemy != null)
                    {
                        //animation
                        tile.enemy.damage(damage);
                        i = -100;
                    }
                    else if (tile.tank != null)
                    {
                        //animation
                        tile.tank.damage(damage);
                        i = -100;
                    }
                }
                if (i != -100)
                {
                    //miss animation
                }
                else
                {
                    //play audio
                }
            }
        }
        else if (target.x > pos.x && target.y > pos.y)
        {
            int i;
            for (i = 1; Mathf.Floor(pos.x + 0.5f * i) < grid.getCols() && Mathf.Round((pos.y + i * 0.75f) / 0.75f) < grid.getRows(); i++)
            {
                tile = (grid.objects[(int)Mathf.Floor(pos.x + 0.5f * i), (int)Mathf.Round((pos.y + i * 0.75f) / 0.75f)].GetComponent(typeof(tileData)) as tileData);
                if (tile.city)
                {
                    //animation
                    grid.damageCity(damage);
                    i = 100;
                }
                else if (tile.blocked)
                {
                    i = 100;
                    //run animation
                }
                else if (tile.enemy != null)
                {
                    //animation
                    tile.enemy.damage(damage);
                    i = 100;
                }
                else if (tile.tank != null)
                {
                    //animation
                    tile.tank.damage(damage);
                    i = 100;
                }
            }
            if (i != 100)
            {
                //miss animation
            }
            else
            {
                //play audio
            }
        }
        else if (target.x > pos.x && target.y < pos.y)
        {
            int i;
            for (i = 1; Mathf.Floor(pos.x + 0.5f * i) < grid.getCols() && Mathf.Round((pos.y - i * 0.75f) / 0.75f) >= 0; i++)
            {
                tile = (grid.objects[(int)Mathf.Floor(pos.x + 0.5f * i), (int)Mathf.Round((pos.y - i * 0.75f) / 0.75f)].GetComponent(typeof(tileData)) as tileData);
                if (tile.city)
                {
                    //animation
                    grid.damageCity(damage);
                    i = 100;
                }
                else if (tile.blocked)
                {
                    i = 100;
                    //run animation
                }
                else if (tile.enemy != null)
                {
                    //animation
                    tile.enemy.damage(damage);
                    i = 100;
                }
                else if (tile.tank != null)
                {
                    //animation
                    tile.tank.damage(damage);
                    i = 100;
                }
            }
            if (i != 100)
            {
                //miss animation
            }
            else
            {
                //play audio
            }
        }
        else if (target.x < pos.x && target.y > pos.y)
        {
            int i;
            for (i = 1; Mathf.Floor(pos.x - 0.5f * i) >= 0 && Mathf.Round((pos.y + i * 0.75f) / 0.75f) < grid.getRows(); i++)
            {
                tile = (grid.objects[(int)Mathf.Floor(pos.x + 0.5f * i), (int)Mathf.Round((pos.y + i * 0.75f) / 0.75f)].GetComponent(typeof(tileData)) as tileData);
                if (tile.city)
                {
                    //animation
                    grid.damageCity(damage);
                    i = 100;
                }
                else if (tile.blocked)
                {
                    i = 100;
                    //run animation
                }
                else if (tile.enemy != null)
                {
                    //animation
                    tile.enemy.damage(damage);
                    i = 100;
                }
                else if (tile.tank != null)
                {
                    //animation
                    tile.tank.damage(damage);
                    i = 100;
                }
            }
            if (i != 100)
            {
                //miss animation
            }
            else
            {
                //play audio
            }
        }
        else
        {
            int i;
            for (i = 1; Mathf.Floor(pos.x - 0.5f * i) >= 0 && Mathf.Round((pos.y - i * 0.75f) / 0.75f) >= 0; i++)
            {
                tile = (grid.objects[(int)Mathf.Floor(pos.x - (0.5f * i)), (int)Mathf.Round((pos.y - (i * 0.75f)) / 0.75f)].GetComponent(typeof(tileData)) as tileData);
                if (tile.city)
                {
                    //animation
                    grid.damageCity(damage);
                    i = 100;
                }
                else if (tile.blocked)
                {
                    i = 100;
                    //run animation
                }
                else if (tile.enemy != null)
                {
                    //animation
                    tile.enemy.damage(damage);
                    i = 100;
                }
                else if (tile.tank != null)
                {
                    //animation
                    tile.tank.damage(damage);
                    i = 100;
                }
            }
            if (i != 100)
            {
                //miss animation
            }
            else
            {
                //play audio
            }
        }
        yield return(new WaitForSeconds(0.1f));
    }
Example #48
0
 void Start()
 {
     board    = BoardManager.Instance;
     eventSys = GameObject.Find("EventSystem").GetComponent <EventSystem>();
 }
Example #49
0
 void Start()
 {
     board = GameObject.Find("Main Camera").GetComponent <BoardManager>();
 }
Example #50
0
        private void CreateBombObject(Vector3 bombPosition, Quaternion bombRotation)
        {
            GameObject prefab = (GameObject)Resources.Load(BombsManager.CurrentBomb.bombPrefabPath, typeof(GameObject));

            BombObjects.Add(MonoBehaviour.Instantiate(prefab, bombPosition, bombRotation, BoardManager.GetBoard()));

            if (!string.IsNullOrEmpty(BombsManager.CurrentBomb.bombSidePrefabPath))
            {
                GameObject prefabSide = (GameObject)Resources.Load(BombsManager.CurrentBomb.bombSidePrefabPath, typeof(GameObject));
                BombObjects.Add(MonoBehaviour.Instantiate(prefabSide, bombPosition, bombRotation, BoardManager.GetBoard()));
                BombObjects.Add(MonoBehaviour.Instantiate(prefabSide, bombPosition, bombRotation, BoardManager.GetBoard()));
            }
        }
Example #51
0
 void Awake()
 {
     BoardManager.instance = this;
 }
Example #52
0
 // Start is called before the first frame update
 private void Awake()
 {
     DontDestroyOnLoad(gameObject);
     _boardManager = GetComponent <BoardManager>();
     InitializeGame();
 }
Example #53
0
 public Player(int p_id, GameObject p_game_object, Vector2 p_position, int p_health, Board p_board, BoardManager p_bm)
 {
     id          = p_id;
     game_object = p_game_object;
     position    = p_position;
     health      = p_health;
     board       = p_board;
     moved       = false;
     facing      = Direction.down;
     bm          = p_bm;
 }
Example #54
0
    // TODO: Should behaviour access BoardManager directly?
    public void Execute()
    {
        BoardManager boardManager = BoardManager.GetInstance();

        boardManager.SetTileAt(Target, boardManager.GetTileAt(Target).DefaultTile.id);
    }
Example #55
0
 public void step(BoardManager board)
 {
     base.Act(); // Attempt To Act
 }
Example #56
0
 private void loadScene()
 {
     boardManager = GetComponent <BoardManager>();
     boardManager.loadScene();
 }
Example #57
0
    protected override void ExecuteLogic()
    {
        switch (currentTurnStep)
        {
        case TurnSteps.Movement:
            ClientPing();
            if (clientController.PlayerNullableNextPosition.HasValue)
            {
                currentTurnStep = TurnSteps.PlayerWillAttack;
            }

            break;

        case TurnSteps.PlayerWillAttack:
            if (clientController.CurrentPlayerState == ClientController.PlayerState.Alien)
            {
                if (!clientController.PlayerNullableWillAttack.HasValue)
                {
                    this.uiController.SetTwoButtonsVisibility(true);
                    ClientPing();
                }
                else
                {
                    this.uiController.SetTwoButtonsVisibility(false);
                    if (clientController.PlayerNullableWillAttack.Value)
                    {
                        clientController.PlayerNullableNexSound = clientController.PlayerNullableNextPosition;
                        ActivateEffectFeedback(EffectFeedback.SectorSound);
                        currentTurnStep = TurnSteps.SendData;
                    }
                    else
                    {
                        currentTurnStep = TurnSteps.Card;
                    }
                }
            }
            else
            {
                currentTurnStep = TurnSteps.Card;
            }
            break;

        case TurnSteps.Card:
            string tileCode = BoardManager.TranslateTilePositionToCode(clientController.PlayerNullableNextPosition.Value);
            BoardManager.PossibleTypes tileType = clientController.GetTileType(tileCode);

            if (tileType == BoardManager.PossibleTypes.EventTile)
            {
                EventDeck.CardTypes cardType = clientController.Deck.DrawCard();

                switch (cardType)
                {
                case EventDeck.CardTypes.AnySectorSound:
                    TimeLogger.Log("CLIENT {0} can choose a sector to make a noise", clientController.ClientId);
                    uiController.SetInfoText("Choose an alarm sector");
                    ActivateEffectFeedback(EffectFeedback.ChooseSector);
                    clientController.GlowPossibleNoises();
                    currentTurnStep = TurnSteps.Noise;
                    break;

                case EventDeck.CardTypes.CurrentSectorSound:
                    TimeLogger.Log("CLIENT {0} make a noise in his sector", clientController.ClientId);
                    ActivateEffectFeedback(EffectFeedback.SectorSound);
                    clientController.PlayerNextSound = clientController.PlayerNextPosition;
                    currentTurnStep = TurnSteps.Noise;
                    break;

                case EventDeck.CardTypes.NoSound:
                    TimeLogger.Log("CLIENT {0} is silent", clientController.ClientId);
                    ActivateEffectFeedback(EffectFeedback.LuckDangerousSector);
                    currentTurnStep = TurnSteps.SendData;
                    break;
                }
            }
            else
            {
                ActivateEffectFeedback(EffectFeedback.Silent);
                currentTurnStep = TurnSteps.SendData;
            }
            break;

        case TurnSteps.Noise:
            ClientPing();
            if (clientController.PlayerNullableNexSound.HasValue)
            {
                currentTurnStep = TurnSteps.SendData;
            }
            break;

        case TurnSteps.SendData:
            uiController.SetInfoText();
            clientController.ClientCommunication.SchedulePutPlayRequest(
                (Vector2Int)clientController.PlayerNullableNextPosition,
                clientController.PlayerNullableNexSound.HasValue ? (Vector2Int)clientController.PlayerNullableNexSound : new Vector2Int(-1, -1),     // TODO - check if is there better solutions than V(-1,-1)
                clientController.PlayerNullableWillAttack.HasValue ? (bool)clientController.PlayerNullableWillAttack : false
                );
            StateEnd();
            break;
        }
    }
Example #58
0
    public override void DistributeReward(BoardManager bm)
    {
        ActorData m = Globals.campaign.contentLibrary.actorDB.GetCopy(characterKey);

        bm.party.partyCharacter.Add(m);
    }
Example #59
0
// Use this for initialization
    void Start()
    {
        difficulty = GameObject.Find("Difficulty").GetComponent <DifficultyScript> ().getDifficulty();

        GameObject.Find("NormalButton").GetComponent <DifficultyButtonScript> ().setState(Enums.SelectorState.Blocked);
        GameObject.Find("HardButton").GetComponent <DifficultyButtonScript> ().setState(Enums.SelectorState.Blocked);
        GameObject.Find("ExpertButton").GetComponent <DifficultyButtonScript> ().setState(Enums.SelectorState.Blocked);
        GameObject.Find("Back").GetComponent <BackScript> ().setState(Enums.SelectorState.Blocked);

        Vector3 scale = GameObject.Find("Selector").GetComponent <Transform> ().localScale;

        scale.x = 0.5F;
        scale.y = 0.5F;
        GameObject.Find("Selector").GetComponent <Transform> ().localScale = scale;

        switch (difficulty)
        {
        case 1:

            //ANDROID
            GameObject.Find("Main Camera").GetComponent <Camera> ().orthographicSize = 4.7F;
            GameObject.Find("Hand Camera").GetComponent <Camera> ().orthographicSize = 4.7F;
            GameObject.Find("Selector").GetComponent <Transform> ().Translate(new Vector3(0, 4f, 0), Space.World);
            GameObject.Find("Quit").GetComponent <Transform> ().Translate(new Vector3(0, 4f, 0), Space.World);
            GameObject.Find("Back").GetComponent <Transform> ().Translate(new Vector3(0, 4f, 0), Space.World);
            break;

        case 2:
            GameObject.Find("Main Camera").GetComponent <Camera> ().orthographicSize = 5.4F;
            GameObject.Find("Hand Camera").GetComponent <Camera> ().orthographicSize = 5.4F;
            GameObject.Find("Selector").GetComponent <Transform> ().Translate(new Vector3(0, 4f, 0), Space.World);
            GameObject.Find("Quit").GetComponent <Transform> ().Translate(new Vector3(0, 4f, 0), Space.World);
            GameObject.Find("Back").GetComponent <Transform> ().Translate(new Vector3(0, 4f, 0), Space.World);
            break;

        case 3:
            GameObject.Find("Main Camera").GetComponent <Camera> ().orthographicSize = 5.4F;
            GameObject.Find("Hand Camera").GetComponent <Camera> ().orthographicSize = 5.4F;
            GameObject.Find("Selector").GetComponent <Transform> ().Translate(new Vector3(0, 4.8F, 0), Space.World);
            GameObject.Find("Quit").GetComponent <Transform> ().Translate(new Vector3(0, 4.8f, 0), Space.World);
            GameObject.Find("Back").GetComponent <Transform> ().Translate(new Vector3(0, 4.8f, 0), Space.World);
            break;
        }



        // Generating the random map with a given difficulty.
        mapCreator = new MapCreator(difficulty);

        // Retrieving the BoardManager.
        boardManager = GetComponent <BoardManager> ();

        // Retrieving the hand.
        hand = GameObject.Find("Hand").GetComponent <HandPrefabScript> ();

        // Drawing the tiles of the board on the screen.
        boardManager.run(mapCreator);

        // Drawing the tiles of the hand on the screen.
        hand.setHand(mapCreator.getHand(), difficulty);

        // Setting up the moves storing.
        moves       = new System.Collections.Generic.List <TileScript> ();
        targetCoord = new System.Collections.Generic.List <Coordinate> ();
        targetEntr  = new System.Collections.Generic.List <int> ();
        targetPos   = new System.Collections.Generic.List <Vector3> ();

        // Starting the game.
        startGame();
    }
Example #60
0
 void Start()
 {
     bm          = FindObjectOfType <BoardManager>();
     gameManager = FindObjectOfType <OverallGameManager>();
 }