Inheritance: MonoBehaviour
Exemple #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            //ScreenPosition = new Vector2(200,200);

            graphics.PreferredBackBufferWidth  = 800;
            graphics.PreferredBackBufferHeight = 600;

            graphics.ApplyChanges();


            scene1 = new MainScene();
            bscene = new BattleScene();
            EndScene escene = new EndScene();

            bscene.game = this;
            scene1.Initialize();
            bscene.Initialize();
            sceneManager = new SceneManager();
            sceneManager.scenes.Add(scene1);
            sceneManager.scenes.Add(bscene);
            sceneManager.scenes.Add(escene);
            sceneManager.currentScene = scene1;
            renderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.PresentationParameters.BackBufferWidth,
                                              GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.None);
            renderTarget2 = new RenderTarget2D(graphics.GraphicsDevice, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            base.Initialize();
        }
Exemple #2
0
 public void OnTriggerEnter2D(Collider2D otherCollider)
 {
     if (otherCollider.gameObject.CompareTag("Player"))
     {
         EndScene.loadWinScene();
     }
 }
 private void Awake()
 {
     if (epilogue == null)
     {
         epilogue = this;
     }
 }
    private void Start()
    {
        if (endScene == null)
        {
            endScene = GameObject.FindObjectOfType <EndScene>();
        }
        if (saveAndLoad == null)
        {
            saveAndLoad = GameObject.FindObjectOfType <SaveAndLoad>();
        }
        if (tasks == null)
        {
            tasks = GameObject.FindObjectOfType <Tasks>();
        }

        //tasks checlk the total games amount
        if (TotalGames == 25 && Tasks.Task_4_completed == false)
        {
            Tasks.Task_4_completed = true;
            GoldAmount            += 200;
            SaveAndLoad.Save();
        }
        if (TotalGames == 35 && Tasks.Task_6_completed == false)
        {
            Tasks.Task_6_completed = true;
            GoldAmount            += 200;
            SaveAndLoad.Save();
        }
        if (TotalGames == 50 && Tasks.Task_11_completed == false)
        {
            Tasks.Task_11_completed = true;
            GoldAmount += 500;
            SaveAndLoad.Save();
        }
        if (TotalGames == 100 && Tasks.Task_18_completed == false)
        {
            Tasks.Task_18_completed = true;
            GoldAmount += 500;
            SaveAndLoad.Save();
        }
        if (TotalGames == 150 && Tasks.Task_24_completed == false)
        {
            Tasks.Task_24_completed = true;
            GoldAmount += 1000;
            SaveAndLoad.Save();
        }
        if (TotalGames == 180 && Tasks.Task_26_completed == false)
        {
            Tasks.Task_26_completed = true;
            GoldAmount += 1000;
            SaveAndLoad.Save();
        }
        if (TotalGames == 200 && Tasks.Task_30_completed == false)
        {
            Tasks.Task_30_completed = true;
            GoldAmount += 1000;
            SaveAndLoad.Save();
        }
    }
 // Use this for initialization
 void Awake()
 {
     lockedBar = transform.parent.FindChild("Canvas").FindChild("Locked").transform;
     death     = Resources.Load("Sounds/Male_Shout-of-Pain_132") as AudioClip;
     //death = Resources.Load("Sounds/(Praise) F**k") as AudioClip;
     deathPart = Resources.Load <GameObject>("Death");
     gOver     = Camera.main.GetComponent <EndScene>();
 }
        public void EndSceneIsShowingEnd()
        {
            // Arrange
            Scene scene = new EndScene();

            // Act
            var result = scene.Show();

            // Assert
            Assert.AreEqual("End", result);
        }
    // Use update to check for jumping (since jumping is a one-time thing)
    void Update()
    {
        if (onGround && Input.GetKeyDown(jumpKey))
        {
            onGround = false;
            _body.AddForce(jumpForce * Vector2.up);
        }

        if (transform.position.y < loseYPos)
        {
            EndScene.loadLoseScene();
        }
    }
    [SerializeField] private Animator m_Anim;                       // Animator to fade to black


    // Use this for initialization
    void Start()
    {
        if (s_Instance == null)
        {
            s_Instance = this;
            m_Manager  = IntroSessionManager.s_Instance;
            StartCoroutine(Run());
        }
        else
        {
            Destroy(gameObject);
        }
    }
Exemple #9
0
 // Start is called before the first frame update
 void Start()
 {
     remain_heart         = this.GetComponent <Text>();
     controller           = GameObject.FindWithTag("Player").GetComponent <PlayerController>();
     is_check_ienumerator = false;
     is_end_typing        = false;
     target            = GameObject.Find("HeartCollector");
     es                = end_scene.GetComponent <EndScene>();
     current_life      = controller.life;
     add_heart_integer = 0;
     is_timer_reduce   = false;
     p_canvas          = GetComponentInParent <Canvas>();
 }
Exemple #10
0
    void Start()
    {
        EndScene.instance = this;
        this.scorerecord  = GameObject.Find("scorerecord");
        this.bestscore    = GameObject.Find("bestscore");
        this.deadcause    = GameObject.Find("deadcause");



        this.scorerecord.GetComponent <Text>().text = "점수 : " + ScoreRecord.instance.result().ToString("F0");
        this.bestscore.GetComponent <Text>().text   = "최고점수 : " + ScoreRecord.instance.result2().ToString("F0");

        if (HpDirector.instance.nowhp <= 0)
        {
            this.deadcause.GetComponent <Text>().text = "당신의 남은 체력이 0이 되어서 " +
                                                        "사망하였습니다.";
        }

        if (TimeLimit.instance.limittime <= 0)
        {
            this.deadcause.GetComponent <Text>().text = "당신의 남은 시간이 0이 되어서 " +
                                                        "사망하였습니다.";
        }
    }
 public void ShowFinalScene()
 {
     EndScene.SetActive(true);
     StartScene.SetActive(false);
     GameplayScene.SetActive(false);
 }
 public void ShowGameplayScene()
 {
     GameplayScene.SetActive(true);
     StartScene.SetActive(false);
     EndScene.SetActive(false);
 }