示例#1
0
 // Use this for initialization
 void Start()
 {
     Sushi    = GameObject.Find("Canvas");
     UISsushi = GameObject.Find("Canvas/GameplayManager");
     _gm      = UISsushi.GetComponent <GameManeger> ();
     SSushib  = Sushi.GetComponent <SpawnSushiB>();
 }
示例#2
0
    void CmdPlayerShoot(string _player_ID, int _damage)
    {
        Debug.Log(_player_ID + "Has been shoot");
        Player _player = GameManeger.GetPLayer(_player_ID);

        _player.RpcTakeDamage(_damage);
    }
示例#3
0
    public void clickOnItem()
    {
        inventory = GameManeger.instance;
        inventory.OnItemChangedCallback += UpdateUI;
        inventorySlots = itemsParent.GetComponentsInChildren <InventorySlot>();
        InventorySlot inventoryOne = (ingredientOne.GetComponentInChildren <InventorySlot>());
        InventorySlot inventoryTwo = (ingredientTwo.GetComponentInChildren <InventorySlot>());
        Item          itemOne      = inventoryOne.getItem();
        Item          itemTwo      = inventoryTwo.getItem();

        inventory.Remove(itemOne);
        inventory.Remove(itemTwo);
        Item myItem = itemOne.makes[0];

        inventory.Add(myItem);
        foreach (Transform child in ingredientOne.transform)
        {
            child.gameObject.SetActive(false);
            DropZone dz = child.GetComponent <DropZone>();
            if (dz)
            {
                dz.myItem = null;
            }
        }
        foreach (Transform child in ingredientTwo.transform)
        {
            child.gameObject.SetActive(false);
            DropZone dz = child.GetComponent <DropZone>();
            if (dz)
            {
                dz.myItem = null;
            }
        }
        this.transform.GetComponent <Button>().interactable = false;
    }
示例#4
0
    //シーン移動をするための関数
    public void Jump(string Jumpname)
    {
        GameManeger game = GameObject.Find("GameManeger").GetComponent <GameManeger>();

        game.nowScene = SceneManager.GetActiveScene().name;
        SceneManager.LoadScene(Jumpname);
    }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        cam_pos  = Camera.main.transform.position;
        this_pos = this.transform.position;
        pos      = this_pos;
        GameManeger gamemaneger = gameobject.GetComponent <GameManeger> ();

        if (gamemaneger.GameOver == false && gamemaneger.Pause == false)
        {
            if (Input.GetKey(KeyCode.LeftArrow))
            {
                pos.x = pos.x - 0.1f * 3.0f / 4.0f;
            }
            if (Input.GetKey(KeyCode.RightArrow))
            {
                pos.x = pos.x + 0.1f * 3.0f / 4.0f;
            }


            if (cam_pos.x - this_pos.x >= 1.5f * WIDTH)
            {
                pos.x = pos.x + 3.0f * WIDTH;
            }
            else if (this_pos.x - cam_pos.x >= 1.5f * WIDTH)
            {
                pos.x = pos.x - 3.0f * WIDTH;
            }
            this.transform.position = pos;
        }
    }
示例#6
0
 private void Start()
 {
     player     = GameObject.FindWithTag("Player").GetComponent <PlayerMove>();
     mane       = GameObject.Find("GameManeger").GetComponent <GameManeger>();
     wall       = GameObject.Find("Door");
     stateClass = (MainStateClass)mane.NowManager;
 }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        GameManeger gamemaneger = GameObject.Find("GameManeger").GetComponent <GameManeger> ();

        if (gamemaneger.GameOver == false)
        {
            if (countdown <= 290)
            {
                gear_change = true;
            }

            if (countdown <= 0)
            {
                gamemaneger.GameOver = true;
                gear_change          = false;
            }

            if (gamemaneger.Pause == false)
            {
                if (gear_change == false)
                {
                    countdown = countdown - Time.deltaTime;
                }
                else
                {
                    countdown = countdown - 5 * Time.deltaTime;
                }
            }
        }
        msg.text = "TIME:" + Mathf.Floor(countdown);
    }
示例#8
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     initializeProjectileDict();
 }
示例#9
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     gameManager = GameManeger.instance;
 }
示例#10
0
    public override void OnStartClient()
    {
        base.OnStartClient();
        string _netID  = GetComponent <NetworkIdentity>().netId.ToString();
        Player _player = GetComponent <Player>();

        GameManeger.RegisterPlayer(_netID, _player);
    }
示例#11
0
    AudioSource audioSource;//カメラにつけることでPlayerがfalseでも聞こえるようにしよう

    // Use this for initialization
    void Start()
    {
        gameManeger = GameObject.Find("GameManeger").GetComponent <GameManeger>();
        mainCamera  = GameObject.Find("Main Camera").GetComponent <Camera>();
        Hp          = 1;
        rb          = GetComponent <Rigidbody2D>();
        MovePower   = 12;
        isDeath     = false;
    }
示例#12
0
 void Start()
 {
     petCol                      = GetComponent <Collider2D>();
     petAnim                     = GetComponent <Animator>();
     gameManager                 = GameManeger.instance;
     spriteRn                    = GetComponentInChildren <SpriteRenderer>();
     spriteRn.sprite             = petData.petArt;
     GameEvents.instance.onFeed += feedPet;
 }
示例#13
0
 // Use this for initialization
 void Start()
 {
     //初期値設定
     gm = GameObject.FindGameObjectWithTag("GM").GetComponent <GameManeger>();
     for (int i = 0; i < 8; i++)
     {
         this.initPos[i] = gm.lastCheckPointPos[i];
     }
 }
示例#14
0
    // Update is called once per frame
    void Start()
    {
        canvas         = GameObject.Find("Canvas");
        gameManeger    = canvas.GetComponent <GameManeger>();
        originInstance = GameObject.Instantiate(originObject, new Vector3(0, 0, 0), Quaternion.identity);

        //消す処理のためにリストに登録
        gameManeger.AddListLineObject(this.gameObject, originInstance);
    }
示例#15
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.name == "ball3d")
     {
         string WallName = transform.name;
         GameManeger.Score(WallName);
         audioPlay.Play();
         FindObjectOfType <BallControl>().ResetBall();
     }
 }
示例#16
0
    void OnDisable()
    {
        Destroy(playerUIInstance);

        if (isLocalPlayer)
        {
            GameManeger.instance.SetSceneCameraActive(true);
        }

        GameManeger.UnRegisterPlayer(transform.name);
    }
示例#17
0
 private void OnEnable()
 {
     if (Instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         Instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
示例#18
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != null)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }
示例#20
0
 void Awake()
 {
     matchSettings = GetComponent <MatchSettings>();
     if (instance != null)
     {
         Debug.LogError("More than one GameManager in Scene.");
     }
     else
     {
         instance = this;
     }
 }
示例#21
0
 // Start is called before the first frame update
 void Awake()
 {
     if (gm == null)
     {
         gm = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#22
0
    // Start is called before the first frame update
    void Start()
    {
        GameManeger gameManeger = GetComponent <GameManeger>();

        maxLenght = gameManeger.Difficulty + 5;

        corners = maxLenght / 4;
        random  = new System.Random();
        placer  = GetComponent <Placer>();

        placer.fade = corners * 0.4f + 1f + 0.4f;

        Generate();
    }
示例#23
0
 private void Awake()
 {
     //Gamemanegerを別のシーンでも使うために残しておく
     if (!awake)
     {
         awake = true;
         DontDestroyOnLoad(gameObject);
         game = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#24
0
 // Start is called before the first frame update
 void Start()
 {
     collider    = GetComponent <BoxCollider>();
     size        = collider.size;
     player      = GameObject.FindWithTag("Player");
     mane        = GameObject.Find("GameManeger").GetComponent <GameManeger>();
     _stateClass = (MainStateClass)mane.NowManager;
     nav         = GetComponent <NavMeshAgent>();
     anim        = GetComponent <Animator>();
     destime     = 0f;
     audio_      = GetComponent <AudioSource>();
     particle    = transform.GetChild(19).GetComponent <ParticleSystem>();
     //EnemyClassを作成する
     AnimationClass = new BaseAnimation();
 }
示例#25
0
    // Update is called once per frame
    private void Update()
    {
        if (Input.GetKey(KeyCode.LeftArrow))
        {
            //l_midori_move();
        }

        if (Input.GetKey(KeyCode.RightArrow))
        {
            //r_midori_move();
        }

        if (r_move == true)
        {
            gamemaneger = GameObject.Find("GameManeger").GetComponent <GameManeger> ();
            if (gamemaneger.GameOver == false && gamemaneger.Pause == false)
            {
                p   = this.transform.position;
                p.x = p.x + 0.1f;
                this.transform.position = p;
                r_move = false;
            }
        }


        if (l_move == true)
        {
            gamemaneger = GameObject.Find("GameManeger").GetComponent <GameManeger> ();
            if (gamemaneger.GameOver == false && gamemaneger.Pause == false)
            {
                p   = this.transform.position;
                p.x = p.x - 0.1f;
                this.transform.position = p;
                l_move = false;
            }
        }

        if (j_move == true)
        {
            Rigidbody2D rb = this.GetComponent <Rigidbody2D> ();
            gamemaneger = GameObject.Find("GameManeger").GetComponent <GameManeger>();
            if (gamemaneger.GameOver == false && gamemaneger.Pause == false)
            {
                rb.AddForce(transform.up * 400.0f);
                j_move = false;
            }
        }
    }
示例#26
0
 public PlayerUIClass(GameManeger manager, GameObject p, GameObject Camvas, GameObject Camvas2) : base(manager)
 {
     _stateClass    = (MainStateClass)manager.NowManager;
     AnimationClass = p.GetComponent <PlayerAnimation>();
     Playermove     = p.GetComponent <PlayerMove>();
     //ここからはゲームシーンのみ使う
     _Effect = Camvas.transform.GetChild(1).gameObject;
     _Effect.SetActive(false);
     //HPのスライダー処理
     HP_ber          = Camvas2.transform.GetChild(1).GetComponent <Slider>();
     HP_ber.maxValue = Playermove.GetSetHP;
     //範囲攻撃可能のスライダー処理
     Range_ber          = Camvas.transform.GetChild(4).GetComponent <Slider>();
     Range_ber.maxValue = 7;
     log = Camvas.transform.GetChild(3).GetComponent <Text>();
 }
示例#27
0
    private void Awake()
    {
        if (gm == null)
        {
            gm = this;
        }
        else if (gm != this)
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
        filePath = Application.persistentDataPath + "/playerInfo.dat";

        missions = new MissionBase[3];

        if (File.Exists(filePath))
        {
            Load();
        }
        else
        {
            for (int i = 0; i < missions.Length; i++)
            {
                GameObject newMission = new GameObject("Mission" + i);
                newMission.transform.SetParent(transform);
                MissionType[] missionType = { MissionType.SingleRun, MissionType.TotalMeter, MissionType.FishesSingleRun };
                int           ramdomType  = Random.RandomRange(0, missionType.Length);

                if (ramdomType == (int)MissionType.SingleRun)
                {
                    missions[i] = newMission.AddComponent <SingleERun>();
                }
                else if (ramdomType == (int)MissionType.TotalMeter)
                {
                    missions[i] = newMission.AddComponent <TotalMeters>();
                }
                else if (ramdomType == (int)MissionType.FishesSingleRun)
                {
                    missions[i] = newMission.AddComponent <FishesSingleRun>();
                }
                missions[i].Created();
            }
        }
    }
示例#28
0
    // Update is called once per frame
    void Update()
    {
        Vector3 pos = transform.position;

        pos.z /= 1.03f;
        transform.position = pos;

        if (transform.position.y < bottomY)
        {
            Destroy(gameObject);
            GameManeger scriptGM = GameObject.Find("GameManeger").GetComponent <GameManeger>();
            scriptGM.Promah();
        }
        if (this.tag == "Promah")
        {
            transform.position = transform.position;
            animator           = GetComponent <Animator>();
            animator.SetBool("Pusk", true);
            Destroy(gameObject, 2f);
        }
    }
示例#29
0
 void Awake()
 {
     scene = SceneManager.GetActiveScene();
     if (instance != null)
     {
         Debug.LogWarning("trying to make two instances of Gamemaneger");
         return;
     }
     instance          = this;
     gun               = PlayerPrefs.GetInt(gunItem.name);
     Fidla             = PlayerPrefs.GetInt(fidlaItem.name);
     slime             = PlayerPrefs.GetInt(slimeItem.name);
     fertilizer        = PlayerPrefs.GetInt(fertilizerItem.name);
     bones             = PlayerPrefs.GetInt(boneItem.name);
     Gold              = PlayerPrefs.GetInt("gold");
     SkellingtonsKills = PlayerPrefs.GetInt("skellingtonsKills");
     SlimeKills        = PlayerPrefs.GetInt("slimeKills");
     exp               = PlayerPrefs.GetInt("exp");
     wrench            = PlayerPrefs.GetInt(WrenchItem.name);
     hammer            = PlayerPrefs.GetInt(hammerItem.name);
     Liberated         = PlayerPrefs.GetInt(scene.name) != 0;
 }
    void Start()
    {
        var SoundState = GameObject.Find("Sound").GetComponent <MainMenuController> ();

        SoundState.SoundOnOf();

        if (instanse == null)
        {
            instanse = this;
        }
        else if (instanse != this)
        {
            Destroy(gameObject);
        }

        _bestScore = PlayerPrefs.GetInt("HiScore", 0);

        Score();
        Setup();

//		if(_timer<=0)
//		Setup2 ();
    }
 // Use this for initialization
 void Start()
 {
     script = this;
     Time.timeScale = 1;
 }