Exemple #1
0
 private void Start()
 {
     navMeshAgent  = GetComponent <NavMeshAgent>();
     fighter       = GetComponent <Fighter>();
     health        = GetComponent <Health>();
     player        = GameObject.FindWithTag("Player");
     mover         = GetComponent <ClickMove>();
     guardPosition = transform.position;
 }
Exemple #2
0
 void Start()
 {
     character = GetComponent <Character>();
     RF        = GetComponent <RangeFinder>();
     if (character)
     {
         CharacterPlayerNav = character.GetPlayerNav();
     }
 }
Exemple #3
0
    void Awake()
    {
        if (ClickMove.instance == null)
        {
            ClickMove.instance = this;
        }
        cc = Player.GetComponent <CharacterController>();

        target.transform.rotation = rotation;
    }
Exemple #4
0
 void Cube()
 {
     other = GameObject.Find ("Cube");
     clickmove=GetComponent<ClickMove> ();
     if (GUI.Button (new Rect (Screen.width / 2, Screen.height / 2, 300, 300), "Change Color")) {
         other.renderer.material.color = Color.blue;
         clickmove.enabled = false;
     } else
         clickmove.enabled = true;
 }
Exemple #5
0
        protected float RateMove(Shape[,] board, ClickMove testMove)
        {
            int columnCount = board.GetLength(0);
              int rowCount = board.GetLength(1);
              Shape target = board[testMove.FromColumn, testMove.FromRow];
              Swap(board, testMove);
              float result = 0;
              try
              {
            //bool isVertical3_1 = false;
            if (testMove.ToRow > 1 && (board[testMove.ToColumn, testMove.ToRow - 2] == board[testMove.ToColumn, testMove.ToRow - 1] && board[testMove.ToColumn, testMove.ToRow - 1] == target))
              result++; //isVertical3_1 = true;

            //bool isVertical3_2 = false;
            if ((testMove.ToRow > 0 && testMove.ToRow < rowCount - 1) && (board[testMove.ToColumn, testMove.ToRow - 1] == target && target == board[testMove.ToColumn, testMove.ToRow + 1]))
              result++; //isVertical3_2 = true;

            //bool isVertical3_3 = false;
            if ((testMove.ToRow < rowCount - 2) && (target == board[testMove.ToColumn, testMove.ToRow + 1] && board[testMove.ToColumn, testMove.ToRow + 1] == board[testMove.ToColumn, testMove.ToRow + 2]))
              result++; //isVertical3_3 = true;

            //        if (isVertical3_1 || isVertical3_2 || isVertical3_3)
            //          return 1;

            //bool isHorizontal3_1 = false;
            if (testMove.ToColumn > 1 && (board[testMove.ToColumn - 2, testMove.ToRow] == board[testMove.ToColumn - 1, testMove.ToRow] && board[testMove.ToColumn - 1, testMove.ToRow] == target))
              result++; //isHorizontal3_1 = true;

            //bool isHorizontal3_2 = false;
            if ((testMove.ToColumn > 0 && testMove.ToColumn < columnCount - 1) && (board[testMove.ToColumn - 1, testMove.ToRow] == target && target == board[testMove.ToColumn + 1, testMove.ToRow]))
              result++;// isHorizontal3_2 = true;

            //bool isHorizontal3_3 = false;
            if ((testMove.ToColumn < columnCount - 2) && (target == board[testMove.ToColumn + 1, testMove.ToRow] && board[testMove.ToColumn + 1, testMove.ToRow] == board[testMove.ToColumn + 2, testMove.ToRow]))
              result++; //isHorizontal3_3 = true;

            //if (isHorizontal3_1 || isHorizontal3_2 || isHorizontal3_3)
            //          return 1;

            return result;
              }
              finally
              {
            Swap(board, testMove.Flipped);
              }
        }
Exemple #6
0
    // OnTriggerEnter() gets called when this GameObject collides with another GameObject. The parameter Collider it takes is the OTHER collider not THIS.
    void OnTriggerEnter(Collider other)
    {
        // GameObjects have components, name here is an example of how to call one
        Debug.Log(other.gameObject.name);
        // PlayerCharacter here is a name of a script we've attached to another GameObj. Here we check to see if the OTHER thing we've collided w/ has that script attached to it (by checking it's components to see if the script name is there).
        ClickMove player = other.GetComponent <ClickMove>();

        // So we'd just check if that component was null or not to test collision.
        if (player != null)
        {
            Debug.Log("Hit a player");
            // This is us calling the takeDamage function from the attached PlayerCharacter script
            player.painedScreaming();
        }
        // Destroys whatever GameObjs is in the parameter, in this case it kills itself.
        Destroy(this);
        // This is also an example of destroying the GAMEOBJECT the script is attached to
        Destroy(gameObject);
    }
Exemple #7
0
    void Start()
    {
        PlayerNav = GetComponent <ClickMove>();

        HealthBar = GetComponentInChildren <Image>();

        NameBox.text = _name;

        UpdateMoney(money);

        Spawn();

        GLOBAL.PlayingAs = this;

        shop = GetComponent <Shop>();
        if (shop)
        {
            shop.ShowHide(false);
        }
    }
Exemple #8
0
 protected void Swap(Shape[,] board, ClickMove move)
 {
     Shape temp = board[move.ToColumn, move.ToRow];
       board[move.ToColumn, move.ToRow] = board[move.FromColumn, move.FromRow];
       board[move.FromColumn, move.FromRow] = temp;
 }
Exemple #9
0
 //    void  ai_1(){
 //        //other = GameObject.Find ("npc_1");
 //        clickmove=GetComponent<ClickMove> ();
 //        //if (GUI.Button (new Rect (Screen.width / 2, Screen.height / 2, 300, 300), "Move left")) {
 //            //transform.position += Vector3.left * 10.0f;
 //            //other.renderer.material.color = Color.blue;
 //            clickmove.enabled = false;
 //        // else
 //            //clickmove.enabled = true;
 //        
 //    }
 void dontmove()
 {
     clickmove = GetComponent<ClickMove> ();
     clickmove.enabled = false;
 }
Exemple #10
0
 private void MoveSquares(ClickMove move)
 {
     MoveSquares(move.FromColumn, move.FromRow, move.ToColumn, move.ToRow);
 }
Exemple #11
0
 // Start is called before the first frame update
 void Start()
 {
     _clickMove = GetComponent <ClickMove>();
     _renderer  = GetComponent <Renderer>();
     Deselect();
 }
 void Start()
 {
     furniture = GetComponent <Furniture>();
     player    = GameObject.FindWithTag("Player").GetComponent <ClickMove>();
 }