예제 #1
0
파일: GM_Main.cs 프로젝트: INao-mp/MNL
 void Awake()
 {
     if (gm == null)
     {
         gm = this;
     }
 }
    void Start()
    {
        gameModeRef      = FindObjectOfType <GM_Main>();
        cam              = GetComponent <Camera>();
        originalCamSpeed = cameraSpeed;

        foreach (GameObject playerInstance in gameModeRef.playerInstances)
        {
            targets.Add(playerInstance.transform);
        }
    }
예제 #3
0
  public void DamagePlayer(int damage)
  {
      stats.curHealth -= damage;

      if (stats.curHealth <= 0)
      {
          GM_Main.KillPlayer(this);
          Debug.Log("You Die!");
      }

      statInd.SetHealth(stats.curHealth, stats.maxHealth);
  }
예제 #4
0
    public void DamageEnemy(int damage)
    {
        stats.curHealth -= damage;

        if (stats.curHealth <= 0)
        {
            GM_Main.KillEnemy(this);
            Debug.Log("Enemy Die!");
        }

        if (statInd != null)
        {
            statInd.SetHealth(stats.curHealth, stats.maxHealth);
        }
    }
예제 #5
0
    // Start is called before the first frame update
    IEnumerator Start()
    {
        gameModeRef    = FindObjectOfType <GM_Main>();
        cameraToFollow = GameObject.FindWithTag("MainCamera").GetComponent <Camera>();
        spritePortal   = GetComponent <SpriteRenderer>();
        minScale       = transform.localScale;

        while (!gameModeRef.gameOver)
        {
            yield return(new WaitForSecondsRealtime(Random.Range(waitTimeMin, waitTimeMax)));

            yield return(Lerp(minScale, maxScale, lerpDuration));

            yield return(Lerp(maxScale, minScale, lerpDuration));
        }
    }
예제 #6
0
    // Initialization
    void Awake()
    {
        inputJump       = "P" + controllerNumber + "Jump";
        inputSlide      = "P" + controllerNumber + "Slide";
        inputAction     = "P" + controllerNumber + "Action";
        inputHorizontal = "P" + controllerNumber + "Horizontal";
        inputVertical   = "P" + controllerNumber + "Vertical";

        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <Animator>();
        ipReference    = GetComponent <ItemPickup>();

        mainCamera       = GameObject.FindWithTag("MainCamera");
        mainCameraScript = (MultipleTargetCamera)mainCamera.GetComponent(typeof(MultipleTargetCamera));

        /*
         * main = GameObject.FindWithTag("GameController");
         * mainScript = (GM_Main)main.GetComponent(typeof(GM_Main));
         * players = mainScript.getPlayers();
         */
        gameModeReference = FindObjectOfType <GM_Main>();
    }