Exemple #1
0
    // Start is called before the first frame update
    public override void Start()
    {
        base.Start();

        playerCollider = GetComponent <CapsuleCollider>();
        gameManager    = GetComponentInParent <DDOL>();

        uiManager      = gameManager.GetComponentInChildren <UIManager>();
        currentstamina = MaxStamina;


        Ground    = gameManager.whatIsGround;
        WeaponHit = gameManager.whatIsEnemy;


        playerAudioSource      = GetComponent <AudioSource>();
        playerAudioSource.clip = gunshotAudio;

        gameManager.lastCheckpoint = transform.position;

        gunParticle      = particleObject.GetComponent <ParticleSystem>();
        gunFlashParticle = particleObject.GetComponentInChildren <ParticleSystem>();


        Foot.isActive = false;
        Foot.force    = KickVector;
        Foot.damage   = KickDamage;
    }
Exemple #2
0
    void Awake()
    {
        if (DDOL.instance == null)
        {
            DontDestroyOnLoad(this.gameObject);
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        // if (objs.Contains(name))
        // {
        //     Destroy(gameObject);
        // }
        // else
        // {
        //     objs.Add(name);
        //     DontDestroyOnLoad(gameObject);
        //     for (int i = 0; i < transform.childCount; i++)
        //     {
        //         transform.GetChild(i).gameObject.SetActive(true);
        //     }
        // }
    }
 void Awake()
 {
     if (GameManager.instance == null)
     {
         Instantiate(gameManager);
     }
     ddolIns = DDOL.GetInstance();
 }
    public void SetOnNextLevel()
    {
        DDOL dd = DDOL.GetInstance();

        dd.change    = false;
        points       = dd.points;
        currentLevel = dd.level;
        lives        = dd.lives;
    }
 // Use this for initialization
 void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         Instance = this;
     }
     else
         Destroy(this.gameObject);
 }
Exemple #6
0
 public override void Awake()
 {
     base.Awake();
     ddol           = GameObject.FindObjectOfType <DDOL>();
     levelManager   = GameObject.FindObjectOfType <LevelManager>();
     gameManager    = GameObject.FindObjectOfType <GameManager>();
     commandMenu    = GameObject.FindObjectOfType <CommandMenu>();
     itemMenu       = GameObject.FindObjectOfType <ItemMenu>();
     spriteRenderer = GetComponent <SpriteRenderer>();
 }
    void InitGame()
    {
        Debug.Log("gm");
        DDOL dd = DDOL.GetInstance();

        gameType     = "arkanoid";
        MAX_LIVES    = dd.lives;
        currentLevel = dd.level;
        points       = dd.points;
        lives        = dd.lives;
    }
Exemple #8
0
    void Start()
    {
        if (instance != null)
        {
            Destroy(this.gameObject);
            return;
        }

        instance = this;
        DontDestroyOnLoad(this.gameObject);
    }
 void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Exemple #10
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemple #11
0
 // Use this for initialization
 void Awake()
 {
     if (Instance == null)
     {
         DontDestroyOnLoad(this.gameObject);
         Instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Exemple #12
0
 public void Awake()
 {
     ddol = GameObject.FindObjectOfType <DDOL>();
     playerObjectHolder  = transform.Find("Players");
     mobObjectHolder     = transform.Find("Mobs");
     tileObjectHolder    = transform.Find("Tiles");
     blockerObjectHolder = transform.Find("Blockers");
     overlayObjectHolder = transform.Find("Overlays");
     itemObjectHolder    = transform.Find("Items");
     tileMatrix          = new Tile[width, height];
     instance            = this;
 }
 void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(gameObject);
         return;
     }
     else
     {
         instance = this;
     }
     DontDestroyOnLoad(transform.gameObject);
 }
Exemple #14
0
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         //gameObject.SetActive(false);
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
Exemple #15
0
 private void SetupSingleton()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         gameObject.SetActive(false);
         Destroy(gameObject);
     }
 }
Exemple #16
0
 private void Awake()
 {
     if (staticDDOL == null)
     {
         staticDDOL = this;
         DontDestroyOnLoad(this);
         joint = GetComponent <SpringJoint>();
     }
     else
     {
         Destroy(this.gameObject);
     }
     this.gameObject.SetActive(false);
 }
    // Use this for initialization
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(gameObject);
            return;
        }
        _instance = this;

        if (gameObject.GetComponentInChildren <PlayerNetwork>() != null)
        {
            DontDestroyOnLoad(this);
        }
    }
Exemple #18
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         Debug.LogWarning("[DDOL]: More than one DDOL GameObject detected! Destroying GameObject...");
         //Destroy(gameObject);
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
     }
 }
    // Use this for initialization
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            Instance = this;
            DontDestroyOnLoad(this);
        }
        XRSettings.enabled = false;

        SceneManager.LoadScene(1);
    }
Exemple #20
0
    void Awake()
    {
        //si es la 1ra instancia, la conserva
        if (instance == null)
        {
            instance = this;
        }
        //si ya hay una instancia creada y es distinta a esta, la destruye (para que no haya repetidas)
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        //no se destruye al cambiar de escena
        DontDestroyOnLoad(this);
    }
Exemple #21
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);
    }
    public void LoadNextLevel()
    {
        if (levelCounter[currentGame] == currentLevel && fruitCounter != 3 && easterBlocks != 5)
        {
            currentLevel = 1;
            points       = 0;
            lives        = MAX_LIVES;
            RecordScore();
            SceneManager.LoadScene(0);
            return;
        }
        currentLevel++;
        Debug.Log(currentLevel);
        DDOL dd = DDOL.GetInstance();

        dd.level  = currentLevel;
        dd.lives  = lives;
        dd.points = points;
        dd.change = true;
        if (fruitCounter == 3)
        {
            SceneManager.LoadScene("pacman4");
        }
        if (IsSecretArkanoidLevelAllowed())
        {
            easterBlocks = 0;
        }
        if (SceneManager.GetActiveScene().name == "arkanoid6")
        {
            SceneManager.LoadScene("pacman1");
            return;
        }
        else
        {
            SceneManager.LoadScene(gameType + currentLevel);
        }
    }
    private void Awake()
    {
        patrol   = transform.parent.GetComponent <SimplePatrol>();
        ddol     = GameObject.Find("Manager").GetComponent <DDOL>();
        player   = GameObject.Find("Player");
        rb2D     = transform.parent.gameObject;
        rb       = rb2D.GetComponent <Rigidbody2D>();
        playerHp = player.GetComponent <HPmanager>();
        source   = GetComponent <AudioSource>();


        enemy       = GetComponent <GameObject>();
        anim        = GetComponent <Animator>();
        constraints = GetComponent <ScaleConstraint>();

        foreach (GameObject obj in ddol._ddolObjects)
        {
            if (obj.name == rb2D.name)
            {
                Debug.Log("ovo");
                Destroy(rb2D);
            }
        }
    }
Exemple #24
0
 public void Awake()
 {
     user         = gameObject.GetComponent <Entity>();
     levelManager = GameObject.FindObjectOfType <LevelManager>();
     ddol         = GameObject.FindObjectOfType <DDOL>();
 }
Exemple #25
0
 public void Awake()
 {
     ddol         = GameObject.FindObjectOfType <DDOL>();
     levelManager = GameObject.FindObjectOfType <LevelManager>();
 }