Exemple #1
0
    void Start()
    {
        gameOver = GameObject.Find("GameOverScreen");
        gameOver.SetActive(false);

        player = GameObject.Find("Player").GetComponent <RespawnSystem>();
    }
 // Start is called before the first frame update
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
    static public Result RespawnSystemTestOne()
    {
        Vector3[] spawnPoints = new Vector3[]
        {
            new Vector3(564.992f, 163.1895f),
            new Vector3(153.1190f, 892.6244f),
        };

        Vector3[] enemies = new Vector3[]
        {
            new Vector3(893.853f, 224.94729f),
            new Vector3(153.1190f, 892.6244f),
            new Vector3(38.644f, 63.95401f)
        };

        Vector3[] allies = new Vector3[]
        {
            new Vector3(153.1190f, 892.6244f),
            new Vector3(468.135f, 295.114f)
        };

        int spawnIndex = RespawnSystem.GetBestRespawnPoint(spawnPoints, enemies, allies);
        int expected   = 1;

        return(Verify.AreEqual(expected, spawnIndex, "Correctly spawn away from enemies."));
    }
    /*
     * Initialization method
     */
    private void Start()
    {
        ScenesController scenesController =
            GameObject.FindGameObjectWithTag("ScenesController").GetComponent <ScenesController>();

        mazeConstructor = GetComponent <MazeConstructor>();
        respawnSystem   = GetComponent <RespawnSystem>();
        mazeSurface     = GetComponent <NavMeshSurface>();

        // Maze construction
        mazeConstructor.GenerateNewMaze(scenesController.currentMazeRows, scenesController.currentMazeColumns);

        // Spawn system initialization
        respawnSystem.InitilizeRespawnSystem(mazeConstructor.mazeData);

        // Maze nav mesh surface baking
        mazeSurface.BuildNavMesh();

        // Player positioning
        respawnSystem.SetPlayerRespawn();

        // Enemy respawns
        respawnSystem.SetEnemyRespawnsPositions();

        // Final point
        respawnSystem.SetFinalPoint();

        // Consumables
        respawnSystem.SetConsumableLocations();
    }
Exemple #5
0
 // Start is called before the first frame update
 void Start()
 {
     characterContRef = PlayerCharacterController.request();
     rb = gameObject.GetComponent <Rigidbody>();
     previousConstraints = rb.constraints;
     animRef             = gameObject.GetComponent <Animator>();
     respawnRef          = gameObject.GetComponent <RespawnSystem>();
 }
 private void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("Il y a plus d'une instance de RespawnSystem en jeu");
         return;
     }
     instance = this;
 }
Exemple #7
0
    void Start()
    {
        questManager  = GameObject.Find("QuestManager").GetComponent <QuestManager>();
        respawnSystem = gameObject.GetComponent <RespawnSystem>();
        stats         = gameObject.GetComponent <UnitStats>();

        myGameObject = gameObject;
        myTransform  = gameObject.transform;
        myRigidbody  = GetComponent <Rigidbody>();

        pointa       = myTransform.position;
        pointb       = myTransform.position * dodgeDistance;
        jouneyLength = Vector3.Distance(pointa, pointb);

        Reset();
    }
Exemple #8
0
    // Private function to spawn player at specific position
    private void Spawn(Vector3 position)
    {
        // If a respawn system is found, set this spawn area, as the last spawn
        RespawnSystem respawn = FindObjectOfType <RespawnSystem>();

        if (null != respawn)
        {
            respawn.SetSpawner(this);
        }

        // Instantiate a new player gameobject
        Instantiate <GameObject>(_ballPrefab, position, Quaternion.identity);

        // Deactivate the spawn area, so that it's not triggered by the newly spawned player
        _active = false;
    }
 void Start()
 {
     myGameObject  = gameObject;
     respawnSystem = GetComponent <RespawnSystem>();
 }
 protected override void Awake()
 {
     base.Awake();
     rs = GetComponent <RespawnSystem>();
     lm = GetComponent <LivesSystem>();
 }