Esempio n. 1
0
    public void SpawnRandomPlayer()
    {
        int       randomIndex     = (int)(Random.Range(0, this.listSpawnPoints.Length - 1));
        Transform randomTransform = this.listSpawnPoints[randomIndex].transform;

        this.playerIndexInList = (int)(Random.Range(0, this.listCharacters.Count - 1));

        this.player = this.listCharacters[this.playerIndexInList].GetComponent <SnapGridCharacter>();
        this.player.gameObject.transform.position = randomTransform.position;
        // Hack: calling UsePlayerControls() here bugs
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        this.gridCharacterControl = this.GetComponent <SnapGridCharacter>();
        this.collider             = this.GetComponentInChildren <Collider2D>();

        Assert.IsNotNull(this.gridCharacterControl, "Missing asset");
        Assert.IsNotNull(this.collider, "Missing asset");
        Assert.IsNotNull(this.spriteRenderer, "Missing asset");

        Assert.IsNotNull(this.eventPlayerKilled, "Missing asset");
        Assert.IsNotNull(this.eventAIKilled, "Missing asset");
    }