コード例 #1
0
    private void InitPlayer()
    {
        playerGO = Instantiate(playerPrefab, new Vector3(levelManager.info.playerStart.x, levelManager.info.playerStart.y), Quaternion.identity);
        GridCharacterMovement movementComp = playerGO.GetComponent <GridCharacterMovement>();

        movementComp.coordinate   = levelManager.info.playerStart;
        movementComp.levelManager = levelManager;
        movementComp.GoTo(movementComp.coordinate);

        //Camera.main.GetComponent<FollowGameObject>().target = playerGO;
    }
コード例 #2
0
    private void InitGhost()
    {
        for (int i = 0; i < 1; i++)
        {
            GameObject ghostGO = Instantiate(ghostPrefab, new Vector3(levelManager.info.ghostSpawn.x, levelManager.info.ghostSpawn.y), Quaternion.identity);

            GridCharacterMovement movementCompG = ghostGO.GetComponent <GridCharacterMovement>();
            movementCompG.coordinate   = levelManager.info.ghostSpawn;
            movementCompG.levelManager = levelManager;
            movementCompG.GoTo(levelManager.info.ghostSpawn);

            ghostGO.GetComponent <GhostAI>().player    = playerGO;
            ghostGO.GetComponent <GhostAI>().levelinfo = levelManager.info;

            ghostGO.GetComponent <GridCharacterPathFinding>().levelInfo = levelManager.info;
        }
    }
コード例 #3
0
ファイル: GhostAI.cs プロジェクト: Minitte/COMP8901-AI-Pacman
 private void Awake()
 {
     characterMovement = GetComponent <GridCharacterMovement>();
     pathFinder        = GetComponent <GridCharacterPathFinding>();
 }
コード例 #4
0
 private void Awake()
 {
     m_characterMovement           = GetComponent <GridCharacterMovement>();
     destination                   = new Vector2Int(Mathf.RoundToInt(transform.position.x), Mathf.RoundToInt(transform.position.y));
     m_characterMovement.OnArrive += UpdatePath;
 }