Наследование: MonoBehaviour
Пример #1
1
 // Use this for initialization
 void Start()
 {
     gameMaster = Camera.main.GetComponent<GameMaster> ();
     playerControl = Camera.main.GetComponent<PlayerControl> ();
     stats = Camera.main.GetComponent<Statistics> ();
     source = Camera.main.GetComponent<AudioSource> ();
 }
Пример #2
1
 // Use this for initialization
 void Start()
 {
     crown = Crown.Instance;
     gameMaster = GameMaster.Instance;
     gameMaster.onGameStarts += OnGameStarts;
     crown.onPowerCardStateChanges += UpdatePowerCardInteractivity;
     gameMaster.onTurnEnds += UpdatePowerCardInteractivity;
     gameMaster.simpleOnGameStateChanges += UpdatePowerCardInteractivity;
     UpdatePowerCardInteractivity();
 }
Пример #3
0
 // Use this for initialization
 void Start()
 { 
     anim = GetComponent<Animator>();
     rb = GetComponent<Rigidbody2D>();
     soundHandler = GameObject.FindGameObjectWithTag("GameMaster").GetComponent<GameMaster>();
     //GetComponent<Animator>().SetBool("IsIdle", true);
 }
Пример #4
0
    public override void ProcessCommand(GameMaster gameMaster, string username, string parameters)
    {
        GameObject playerObj = gameMaster.GetPlayerObject(username);
        if (playerObj.activeSelf == false)
        {
            GetComponent<TwitchIRC>().MessageChannel("@" + username + ", can't cast spells when you're dead");
            return;
        }

        if (parameters.Length == 0)
        {
            Team otherTeam = gameMaster.GetOpposingTeam(playerObj.GetComponent<Player>().team);
            otherTeam.TakeDamage(damage);

            CreateZot(playerObj, otherTeam.gameObject);
        }
        else
        {
            GameObject target = gameMaster.GetPlayerObject(parameters);
            if (target != null)
            {
                CreateZot(playerObj, target);
                target.GetComponent<Player>().DealDamage(damage);
            }
        }
    }
Пример #5
0
 void Awake()
 {
     if (instance == null)
         instance = this;
     else if (instance != this)
         Destroy(gameObject);
 }
 // Use this for initialization
 void Start()
 {
     if (gameMaster == null)
     {
         gameMaster = GameObject.FindGameObjectWithTag("GM").GetComponent<GameMaster>();
     }
 }
Пример #7
0
    public void Awake ()
	{
        GM = GameObject.FindGameObjectWithTag("GameMaster").GetComponent<GameMaster>();
		pathUnit = GetComponent<PathfindingUnit>();
        player = GetComponent<Player>();
		
	}
Пример #8
0
        public void MouseClicked(int x, int y, GameMaster sender)
        {
            Rectangle mouseClickRect = new Rectangle(x, y, 10, 10);

            //int resumeWidth = resumeButton.Width / 2;
            //int resumeHeight = resumeButton.Height / 2;

            Rectangle resumeButtonRect = new Rectangle(screenCenter.X - (resumeButton.Width / 2), 400, resumeButton.Width, resumeButton.Height);

            //int quitGameWidth = quitGameButton.Width / 2;
            //int quitGameHeight = quitGameButton.Height / 2;

            Rectangle quitGameButtonRect = new Rectangle(screenCenter.X - (quitGameButton.Width / 2), 500, quitGameButton.Width, quitGameButton.Height);

            if (mouseClickRect.Intersects(resumeButtonRect))
            {
                sender.gameState = PacManMulti.GameMaster.GameState.Playing;
                sender.restart = false;
                sender.isPaused = false;
            }
            else if (mouseClickRect.Intersects(quitGameButtonRect))
            {
                sender.gameState = PacManMulti.GameMaster.GameState.StartMenu;
                sender.restart = true;
                sender.isPaused = false;
            }
        }
Пример #9
0
 void Start()
 {
     if (gm == null) {
         gm = GameObject.FindGameObjectWithTag ("GM").GetComponent<GameMaster> ();
     }
     playerScript = player.GetComponent<Player>();
 }
Пример #10
0
    // Use this for initialization

    void Start()
    {
        spellAnimation = GetComponent<Animator>() as Animator;
        audioReference = GameObject.FindGameObjectWithTag("GameMaster").GetComponent<GameMaster>();
        playerMove = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovement>();
        //castingSpell = false;
    }
Пример #11
0
 void Start()
 {
     defaultfarClipPlane = camera.farClipPlane;
     gameMaster = (GameMaster)GetComponent(typeof(GameMaster));
     gameMaster.isSurface.Subscribe(this.OnSurface);
     OnSurface(false);
 }
 void Awake()
 {
     if (!gm)
     {
         gm = GameObject.FindGameObjectWithTag ("GM").GetComponent<GameMaster>();
     }
 }
Пример #13
0
 // Use this for initialization
 void Start()
 {
     playerControl = Camera.main.GetComponent<PlayerControl> ();
     source = Camera.main.GetComponent<AudioSource> ();
     gameMaster = Camera.main.GetComponent<GameMaster> ();
     timer = 45;
 }
    // Use this for initialization
    void Start()
    {
        GetComponent<Button>().interactable = false;

        gameMaster = GameMaster.instance;
        stats = GameObject.Find("Stats").GetComponent<StatsInterface>();
    }
 // Use this for initialization
 void Awake()
 {
     DontDestroyOnLoad(this);
     if (gm == null)
     {
         gm = GameObject.FindGameObjectWithTag("GM").GetComponent<GameMaster>();
     }
 }
Пример #16
0
	void Awake()
	{
		GM = GameMaster.GM;
		deathSequence = GetComponent<DeathSequence>();
		healthManager = GetComponent<HealthManager>();


	}
Пример #17
0
    public override void ProcessCommand(GameMaster gameMaster, string username, string parameters)
    {
        GameObject playerObj = gameMaster.GetPlayerObject(username);
        if (playerObj == null)
            return;

        playerObj.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Random.Range(0, Screen.width), Random.Range(0, Screen.height), 10));
    }
Пример #18
0
 // Use this for initialization
 void Start()
 {
     timer = 90;
     attackTimer = 0;
     playerControl = Camera.main.GetComponent<PlayerControl> ();
     gameMaster = Camera.main.GetComponent<GameMaster> ();
     source = Camera.main.GetComponent<AudioSource> ();
 }
Пример #19
0
 public void Start()
 {
     if (gm == null)
     {
         gm = GameObject.FindGameObjectWithTag("GM").GetComponent<GameMaster>();
     }
     LoadMap();
 }
Пример #20
0
 void Awake()
 {
     // In case gameMaster prefab cannot be found.
     if (gameMaster == null) {
         // Find a game object prefab that has the tag selected instead.
         gameMaster = GameObject.Find ("GameMaster").GetComponent<GameMaster>();
     }
 }
Пример #21
0
 public void Initialize(GameMaster gameMaster, ClickerType clickerType)
 {
     ClickerType = clickerType;
     StackedClickers = 1;
     _gameMaster = gameMaster;
     SetNewMoveDirection();
     _particleSystem = GetComponent<ParticleSystem>();
 }
Пример #22
0
    void Start()
    {
        if (gm == null) {
            gm = GameObject.FindGameObjectWithTag("GM").GetComponent<GameMaster>();
        }

        InitCredits ();
    }
Пример #23
0
	void Start () {
		if (gm == null) {
			gm = GameObject.FindGameObjectWithTag ("GM").GetComponent<GameMaster>();
		}
		if(camShake == null)
		{
			camShake = GetComponent<CameraShake>();
		}
	}
Пример #24
0
    void Awake()
    {
        if (GM != null)
            GameObject.Destroy(GM);
        else
            GM = this;

        DontDestroyOnLoad(this);
    }
 void Awake()
 {
     GetComponent<SpriteRenderer>().color = new Color(255, 255, 255, 255);
     gameMasterScript = Object.FindObjectOfType<GameMaster>().GetComponent<GameMaster>();
     audioSource = GetComponent<AudioSource>();
     origBoxColliderOff = GetComponent<BoxCollider2D>().offset;
     origBoxCollidSize = GetComponent<BoxCollider2D>().size;
     origCirColliderOff = GetComponent<CircleCollider2D>().offset;
 }
Пример #26
0
        public MapController(Map map, MapView mapView)
        {
            this.map = map;
            this.mapView = mapView;
            this.gm = GameMaster.Inst();

            PromptWindow.Inst().Deactive();
            MarketComponent.Inst().SetIsActive(false);
        }
Пример #27
0
    void Awake()
    {
        if (instance == null)
            instance = this;
        else
            Destroy(gameObject);
		paused = false;
		Time.timeScale = 1.0f;
    }
Пример #28
0
    public override void ProcessCommand(GameMaster gameMaster, string username, string parameters)
	{
		GameObject playerObj = gameMaster.GetPlayerObject(username);
		if (playerObj == null)
			return;

        if (playerObj.activeSelf == false)
        {
            GetComponent<TwitchIRC>().MessageChannel(username + ", can't cast spells when you're dead");
            return;
        }

        Player playerComponent = playerObj.GetComponent<Player>();
		Team team = playerComponent.getTeam();

        // Check in-progress spells
        for (int i = 0; i < team.inProgressSpells.Count; ++i)
        {
            SpellProgress s = team.inProgressSpells[i];
			if (!s.IncrementSpellLine(username, parameters))
				continue;
			
            if (s.SpellComplete()) {
				s.spell.Cast(team, gameMaster.GetOpposingTeam(team));
                team.inProgressSpells.Remove(s);

                string castingGroup = s.casterNames[0];
                for (int j = 1; j < s.casterNames.Length; ++j)
                    castingGroup += ", " + s.casterNames[j];
                gameMaster.GetComponent<TwitchIRC>().MessageChannel(s.spell.spellName + " has been cast by " + castingGroup);
            }

            return;
        }

        // Start a new spell
        Spell[] spells = GetComponents<Spell>();
        foreach (Spell s in spells)
        {
            if (s.lines[0].words != parameters)
                continue;

			SpellProgress newSpellProgress = new SpellProgress(s, username);

			// in case of one-liners:
			if (newSpellProgress.SpellComplete()) {
				newSpellProgress.spell.Cast(team, gameMaster.GetOpposingTeam(team));
			} else {
            	team.inProgressSpells.Add(newSpellProgress);
			}

            return;
        }

        string insult = insults[Random.Range(0, insults.Length)].Replace("*", username);
        GetComponent<TwitchIRC>().MessageChannel(insult);
    }
Пример #29
0
 void Awake()
 {
     if(Instance)
              DestroyImmediate(gameObject);
          else
          {
         DontDestroyOnLoad(gameObject);
         Instance = this;
     }
 }
Пример #30
0
    void Awake()
    {
        GM = this;

        score = 0;
        spiritsCollected = new int[5];
        combo = 0;
        comboTimer = .0f;
        timer = .0f;
    }
    public void Interact()
    {
        if (Input.GetKeyDown(KeyCode.I) == true)
        {
            if (UIManager.hasInventoryOpen() == false)
            {
                UIManager.ShowInventory(GameMaster.Instance.player.getInventory());
            }
            else
            {
                UIManager.CloseInventory();
            }
        }

        if (Input.GetKeyDown(KeyCode.F) == true)
        {
            currentPaletteIndex = Util.WrapInt(currentPaletteIndex += 1, 2, Enum.GetValues(typeof(Voxel)).Length - 1);
            currentVoxel        = (Voxel)currentPaletteIndex;
            UIManager.ForceUpdate();
        }

        //	Everything below here can't be done when mousing over non-clickthrough UI
        if (UIManager.isMouseOverUIWithIgnore() == true)
        {
            return;
        }

        Unity.Physics.RaycastHit hit;
        Unity.Entities.Entity    hitEntity;
        hitData = null;

        if (GameMaster.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), 8, out hit, out hitEntity))
        {
            hitData = new VoxelHitData(hit, hitEntity);

            Vector3 offsetPos = hitData.hitTransform.InverseTransformPoint(hit.Position);

            offsetPos.x = (float)Math.Round(offsetPos.x);
            offsetPos.y = (float)Math.Round(offsetPos.y);
            offsetPos.z = (float)Math.Round(offsetPos.z);

            // offsetPos.x = offsetPos.x - offsetPos.x % 1;
            // offsetPos.y = offsetPos.y - offsetPos.y % 1;
            // offsetPos.z = offsetPos.z - offsetPos.z % 1;

            offsetPos = hitData.hitTransform.rotation * offsetPos;
            Vector3 hitPos = hitData.hitTransform.position + offsetPos;

            Debug.DrawLine(Camera.main.ScreenPointToRay(Input.mousePosition).origin, hitPos, Color.red);
            Debug.DrawRay(hit.Position, hit.SurfaceNormal, Color.yellow);
            Debug.DrawRay(hit.Position, hit.SurfaceNormal * -0.5f, Color.cyan);
        }
        else
        {
            Debug.DrawRay(Camera.main.ScreenPointToRay(Input.mousePosition).origin, Camera.main.ScreenPointToRay(Input.mousePosition).direction * 8, Color.green);
        }

        // if (hit.collider != null)
        // {
        //  Interactable interactable = hit.collider.GetComponent<Interactable>();
        //  if (interactable != null)
        //  {
        //      if (Input.GetMouseButtonDown(1) == true)
        //      {
        //          interactable.TryInteract(GameMaster.Instance.player.gameObject);
        //          return;
        //      }
        //      else
        //      {
        //          interactable.TryHover(GameMaster.Instance.player.gameObject);
        //      }
        //  }
        // }

        Item mainHand = GameMaster.Instance.player.getEquipment().getSlot(EquipmentSlot.MAINHAND);

        if (mainHand.isValid() == false)
        {
            return;
        }

        if (Input.GetKeyDown(KeyCode.G) == true)
        {
            int amountToDrop = 1;

            if (Input.GetKey(KeyCode.LeftControl) == true || Input.GetKey(KeyCode.RightControl) == true)
            {
                amountToDrop = mainHand.getAmount();
            }

            GameMaster.Instance.DropItemNaturally(Position.fromVector3(transform.position + (transform.forward * 3)), mainHand, amountToDrop);
            GameMaster.Instance.player.getInventory().Remove(mainHand, amountToDrop);
        }

        if (hitData == null || hitData.isValid() == false)
        {
            return;
        }

        if (mainHand is BLOCKITEM)
        {
            rotationOrientation = hitData.getFace().getOpposite();
            currentVoxel        = ((BLOCKITEM)mainHand).getVoxel();

            if (Input.GetAxis("Mouse ScrollWheel") > 0)
            {
                rotationIndex     = Util.WrapInt(rotationIndex += 1, 0, 3);
                rotationDirection = (Direction)rotationIndex;
            }
            else if (Input.GetAxis("Mouse ScrollWheel") < 0)
            {
                rotationIndex     = Util.WrapInt(rotationIndex -= 1, 0, 3);
                rotationDirection = (Direction)rotationIndex;
            }

            if (Input.GetMouseButtonDown(1) == true)
            {
                if (hitData.getAtFace().getType() == Voxel.VOID)
                {
                    Block thisBlock = hitData.voxelObject.setBlockAt(hitData.atFace, currentVoxel);

                    if (thisBlock.getChunk() != null)
                    {
                        GameMaster.Instance.player.getInventory().Remove(mainHand, 1);

                        GameMaster.Instance.PlaySound(placeSound, hit.Position);
                        GetComponent <MotionAnimator>().PlayMotion("mainHandAttack");

                        if (thisBlock.getBlockData() is Rotatable)
                        {
                            Rotatable data = (Rotatable)thisBlock.getBlockData();
                            data.setDirection(rotationDirection);
                            thisBlock.setBlockData(data);
                        }

                        if (thisBlock.getBlockData() is Orientated)
                        {
                            Orientated data = (Orientated)thisBlock.getBlockData();
                            data.setOrientation(rotationOrientation);
                            thisBlock.setBlockData(data);
                        }

                        if (hitData.getFace() == Direction.BELOW)
                        {
                            if (thisBlock.getBlockData() is Flippable)
                            {
                                Flippable data = (Flippable)thisBlock.getBlockData();
                                data.setFlipped(true);
                                thisBlock.setBlockData(data);
                            }
                        }
                    }
                }
            }

            UpdateDisplayModel();
            DrawDisplayModel(hitData.localFacePosition);
        }
        else if (mainHand is CUTTER)
        {
            Block clickedBlock = hitData.getAt();

            if (Input.GetMouseButtonDown(0) == true)
            {
                if (clickedBlock.getType() != Voxel.VOID && clickedBlock.getType() != Voxel.SHIP_CORE)
                {
                    Position droppedPosition = Position.fromVector3(hit.Position);
                    GameMaster.Instance.DropItemNaturally(droppedPosition, clickedBlock.getType(), 1);

                    Block thisBlock = hitData.voxelObject.setBlockAt(hitData.atHit, Voxel.VOID);

                    if (thisBlock.getChunk() != null)
                    {
                        GameMaster.Instance.PlaySound(placeSound, hit.Position);
                        GetComponent <MotionAnimator>().PlayMotion("mainHandAttack");
                    }
                }
            }
            else if (Input.GetMouseButtonDown(1) == true)
            {
                if (clickedBlock.getType() != Voxel.VOID && clickedBlock.getType() != Voxel.SHIP_CORE)
                {
                    Block thisBlock = hitData.voxelObject.setBlockAt(hitData.atHit, Voxel.FRAME);

                    if (thisBlock.getChunk() != null)
                    {
                        GameMaster.Instance.PlaySound(placeSound, hit.Position);
                        GetComponent <MotionAnimator>().PlayMotion("mainHandAttack");
                    }
                }
            }

            currentVoxel = clickedBlock.getType();

            if (clickedBlock.getBlockData() is Rotatable)
            {
                Rotatable data = (Rotatable)clickedBlock.getBlockData();
                rotationDirection = data.getDirection();
            }

            if (clickedBlock.getBlockData() is Orientated)
            {
                Orientated data = (Orientated)clickedBlock.getBlockData();
                rotationOrientation = data.getOrientation();
            }

            UpdateDisplayModel();
            DrawDisplayModel(hitData.localPosition);
        }
        else if (mainHand is DRILL)
        {
            if (hitData.isValid())
            {
                rotationOrientation = hitData.getFace().getOpposite();

                if (Input.GetAxis("Mouse ScrollWheel") > 0)
                {
                    rotationIndex     = Util.WrapInt(rotationIndex += 1, 0, 3);
                    rotationDirection = (Direction)rotationIndex;
                }
                else if (Input.GetAxis("Mouse ScrollWheel") < 0)
                {
                    rotationIndex     = Util.WrapInt(rotationIndex -= 1, 0, 3);
                    rotationDirection = (Direction)rotationIndex;
                }

                if (Input.GetMouseButtonDown(2) == true)
                {
                    Block clickedBlock = hitData.getAt();
                    if (clickedBlock.getType() != Voxel.VOID && clickedBlock.getType() != Voxel.SHIP_CORE)
                    {
                        currentVoxel        = clickedBlock.getType();
                        currentPaletteIndex = (int)currentVoxel;
                    }
                }

                if (Input.GetMouseButtonDown(1) == true)
                {
                    if (hitData.getAt().getType() == Voxel.FRAME)
                    {
                        Block thisBlock = hitData.voxelObject.setBlockAt(hitData.atHit, currentVoxel);

                        if (thisBlock.getChunk() != null)
                        {
                            GameMaster.Instance.PlaySound(placeSound, hit.Position);
                            GetComponent <MotionAnimator>().PlayMotion("mainHandAttack");

                            if (thisBlock.getBlockData() is Rotatable)
                            {
                                Rotatable data = (Rotatable)thisBlock.getBlockData();
                                data.setDirection(rotationDirection);
                                thisBlock.setBlockData(data);
                            }

                            if (thisBlock.getBlockData() is Orientated)
                            {
                                Orientated data = (Orientated)thisBlock.getBlockData();
                                data.setOrientation(rotationOrientation);
                                thisBlock.setBlockData(data);
                            }

                            if (hitData.getFace() == Direction.BELOW)
                            {
                                if (thisBlock.getBlockData() is Flippable)
                                {
                                    Flippable data = (Flippable)thisBlock.getBlockData();
                                    data.setFlipped(true);
                                    thisBlock.setBlockData(data);
                                }
                            }
                        }
                    }
                }

                UpdateDisplayModel();
                DrawDisplayModel(hitData.localPosition);
            }
        }
    }
Пример #32
0
 // Use this for initialization
 void Start()
 {
     gm = FindObjectOfType <GameMaster>();     //populate with gm script
     rb = GetComponent <Rigidbody2D>();        //populate with Rigidbody component
 }
Пример #33
0
 void Start()
 {
     gm = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>();
 }
Пример #34
0
 void Awake()
 {
     GameMaster.RegisterPlayer(gameObject);
 }
Пример #35
0
 private void Awake()
 {
     gameMaster = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>();
 }
Пример #36
0
 public void SetUp()
 {
     game  = new GameMaster();
     bytes = game.Bytes;
 }
Пример #37
0
 public void Initialize(GameBoard gameBoard, GameMaster gameMaster)
 {
     _gameBoard  = gameBoard;
     _gameMaster = gameMaster;
 }
Пример #38
0
 void ReturnToStart()
 {
     Time.timeScale = 1;
     GameMaster.ResetGame();
     SceneManager.LoadScene("Start");
 }
Пример #39
0
 void RestartGame()
 {
     Time.timeScale = 1;
     GameMaster.ResetGame();
     SceneManager.LoadScene("Game");
 }
Пример #40
0
 void Start()
 {
     gm = GameMaster.FindObjectOfType <GameMaster> ();
 }
Пример #41
0
 // Use this for initialization
 void Start()
 {
     //Find any object in the scene that has a level manager on it .
     GameMaster = FindObjectOfType <GameMaster>();
 }
Пример #42
0
 public void Retry()
 {
     SceneManager.LoadScene(1);
     GameMaster.Restart();
 }
Пример #43
0
    public Vector3 defOffset = new Vector3(0, 5.5f, 14); // Default/starting offset.

    #endregion

    // Awake - Called before anything else.
    void Awake()
    {
        gm          = GameMaster.CreateGM();
        myTransform = transform;
        gm.cam      = transform;
    }
Пример #44
0
    void Update()
    {
        if (GameMaster.sectionLights >= 6)
        {
            if (GameMaster.j == 3)
            {
                GameMaster.score += 1000000;
            }
            GameMaster.increaseGlobalMulti();
            GameMaster.sectionLights = 0;
            GameMaster.setColor();
            var buttons = FindObjectsOfType <PointBumpers>();
            foreach (PointBumpers button in buttons)
            {
                button.isOn = false;
            }
        }
        //Pause menu stuff
        if (Input.GetKeyDown(KeyCode.Escape) || Input.GetKeyDown(KeyCode.Tab) | Input.GetKeyDown(KeyCode.P) || Input.GetKeyDown(KeyCode.Return) && optionPanel.activeInHierarchy || Input.GetKeyDown(KeyCode.Space) && optionPanel.activeInHierarchy)
        {
            // Debug.Log("escapetest");
            if (pausePanel.activeInHierarchy == false && optionPanel.activeInHierarchy == false)
            {
                PauseGame();
            }
            else if (pausePanel.activeInHierarchy == true && optionPanel.activeInHierarchy == false)
            {
                ContinueGame();
            }
            else
            {
                optionPanel.SetActive(false);
                pausePanel.SetActive(true);
            }
        }

        //Ball based multiplier
        if (timeLeft > 0)
        {
            timeLeft -= Time.deltaTime;
        }
        else
        {
            GameMaster.decreaseMulti();
            if (GameMaster.i > 0)
            {
                timeLeft = multiTime;
            }
        }


        //Lose conditions
        if (activeBalls <= 0 && l)
        {
            lose = true;
            l    = false;
            GameObject.Find("Icons").GetComponent <Icons>().i = 0;
        }

        if (balls <= 1 && lose)
        {
            SceneManager.LoadScene("Enterusername");
        }
        else if (lose)
        {
            balls--;
            lose = false;
        }

        if (activeBalls == 0)
        {
            hasPowerUp = false;
            randPow    = 0;
            startGui.SetActive(true);
            if (Input.GetKey(space) && pausePanel.activeInHierarchy == false && optionPanel.activeInHierarchy == false)
            {
                newBall(ball);
                startGui.SetActive(false);
            }
        }


        //PowerUp code
        //feather
        if (randPow == 3 && Input.GetKeyDown(KeyCode.Space))
        {
            feather = true;
            randPow = 0;
            GameObject.Find("SpacebarSmall").GetComponent <SpriteRenderer>().enabled = false;
        }
        if (feather)
        {
            powTimeLeft -= Time.deltaTime;
            if (powTimeLeft < 0)
            {
                hasPowerUp = false;
                feather    = false;

                GameObject.Find("Icons").GetComponent <Icons>().i = 0;
            }
        }

        //blockBumpie power up
        if (randPow == 5 && Input.GetKeyDown(KeyCode.Space))
        {
            bumpie = true;
            bump   = Instantiate(blockBumpie, new Vector3(n.position.x, n.position.y - 0.5f, n.position.z), transform.rotation);
            GameObject.Find("SpacebarSmall").GetComponent <SpriteRenderer>().enabled = false;
            randPow = 0;
        }
        if (bumpie)
        {
            powTimeLeft -= Time.deltaTime;
            if (powTimeLeft < 0)
            {
                hasPowerUp = false;
                bumpie     = false;
                Destroy(bump);

                GameObject.Find("Icons").GetComponent <Icons>().i = 0;
            }
        }



        //freeze
        if ((randPow == 4) && Input.GetKeyDown(KeyCode.Space))
        {
            freeze  = true;
            randPow = 0;
            GameObject.Find("SpacebarSmall").GetComponent <SpriteRenderer>().enabled = false;
        }
        if (freeze)
        {
            powTimeLeft -= Time.deltaTime;
            if (powTimeLeft < 0)
            {
                hasPowerUp = false;
                freeze     = false;

                GameObject.Find("Icons").GetComponent <Icons>().i = 0;
            }
        }


        //multiball
        if ((randPow == 2) && Input.GetKeyDown(KeyCode.Space))
        {
            mulBall = true;
            randPow = 0;
        }
        if (mulBall)
        {
            powTimeLeft -= Time.deltaTime;
            if (Input.GetKeyDown(KeyCode.Space))
            {
                newBall(ball);
            }
            if (powTimeLeft < 0)
            {
                hasPowerUp = false;
                mulBall    = false;
                GameObject.Find("SpacebarSmall").GetComponent <SpriteRenderer>().enabled = false;
                GameObject.Find("Icons").GetComponent <Icons>().i     = 0;
                GameObject.Find("Mash").GetComponent <Text>().enabled = false;
            }
        }

        //extraball
        if ((randPow == 1) && Input.GetKeyDown(KeyCode.Space))
        {
            extra   = true;
            randPow = 0;
        }
        if (extra)
        {
            powTimeLeft -= Time.deltaTime;
            if (Input.GetKeyDown(KeyCode.Space))
            {
                extraMash++;
                if (extraMash >= 2)
                {
                    balls++;
                    extraMash = 0;
                }
            }
            if (powTimeLeft < 0)
            {
                hasPowerUp = false;
                extra      = false;
                GameObject.Find("SpacebarSmall").GetComponent <SpriteRenderer>().enabled = false;
                GameObject.Find("Icons").GetComponent <Icons>().i     = 0;
                GameObject.Find("Mash").GetComponent <Text>().enabled = false;
            }
        }

        if (randPow == 6)
        {
            save    = true;
            randPow = 0;
        }
        if (save)
        {
            savers.SetActive(true);
            powTimeLeft -= Time.deltaTime;
            if (powTimeLeft < 0)
            {
                hasPowerUp = false;
                save       = false;
                savers.SetActive(false);
                GameObject.Find("Icons").GetComponent <Icons>().i = 0;
            }
        }
    }
Пример #45
0
// Update is called once per frame
    void Update()
    {
        if (isGrounded)
        {
            timeFall  = 0f;
            isJumping = false;
            animator.SetBool("Jump", false);
        }
        if (!isGrounded)
        {
            timeFall += Time.deltaTime;
        }

        if (Input.anyKeyDown)
        {
            animator.SetBool("Wait", false);
            currentTime = Time.time + timeToWait;
        }
        else
        {
            checkTime();
        }

        if (alive)
        {
            animator.SetBool("Dead", false);

            if (Input.GetKey(KeyCode.P))
            {
                StartCoroutine("Die");
            }

            if (Input.GetKey(KeyCode.LeftArrow))
            {
                animator.SetBool("GoLeft", true);
                animator.SetBool("GoRight", false);
                if (!isGrounded && jump_change != -1)
                {
                    rg2d.velocity = new Vector2(-speed / 1.5f, rg2d.velocity.y);
                }
                else
                {
                    //rg2d.velocity = new Vector2(-speed, rg2d.velocity.y);
                }
                jump_change = -1;
                //Debug.Log(jump_change);
            }
            else if (Input.GetKey(KeyCode.RightArrow))
            {
                animator.SetBool("GoLeft", false);
                animator.SetBool("GoRight", true);
                if (!isGrounded && jump_change != 1 && isJumping)
                {
                    rg2d.velocity = new Vector2(speed / 1.5f, rg2d.velocity.y);
                }

                jump_change = 1;
                //Debug.Log(jump_change);
            }
            else
            {
                animator.SetBool("GoLeft", false);
                animator.SetBool("GoRight", false);
            }

            if (Input.GetKey(KeyCode.DownArrow) && !isCrouching)
            {
                isCrouching = true;
                animator.SetBool("Crouch", true);
                float   scale    = collider.radius;
                Vector2 i_offset = collider.offset;
                collider.radius = scale * 0.5f;
                collider.offset = i_offset + new Vector2(scale * 0.5f, -scale * 0.5f + offset_collider);
            }

            else if (Input.GetKeyUp(KeyCode.DownArrow) && isCrouching)
            {
                isCrouching = false;
                animator.SetBool("Crouch", false);
                collider.radius = 0.1474877f;
                collider.offset = new Vector2(-0.04f, 0.0f);
            }

            if (Input.GetKeyDown(KeyCode.UpArrow) && count == 0 && (isGrounded || isJumping))
            {
                animator.SetBool("Jump", true);
                count++;

                rg2d.AddForce(new Vector2(0.0f, jump), ForceMode2D.Impulse);
            }

            if (Input.GetKey(KeyCode.N))
            {
                invincible = true;
            }
            else
            {
                invincible = false;
            }

            if (!isJumping)
            {
                count = 0;
                //isGrounded = true;

                if (Input.GetKey(KeyCode.LeftShift) && !sprint)
                {
                    sprint = true;
                    float new_speed = speed * 1.5f;
                    speed = new_speed;
                }

                else if (Input.GetKeyUp(KeyCode.LeftShift) && sprint)
                {
                    sprint = false;
                    speed  = speed_ini;
                }
            }

            if (Input.GetKeyDown(KeyCode.R))
            {
                if ((animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashLeft) || (animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashStayLeft) || (animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashJumpLeft))
                {
                    isAttacking = true;
                    animator.SetBool("Bite", true);
                    bite(-1);
                }
                else if ((animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashRight) || (animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashStayRight) || (animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashJumpRight))
                {
                    isAttacking = true;
                    animator.SetBool("Bite", true);
                    bite(1);
                }

                /*
                 * isAttacking = true;
                 * animator.SetBool("Bite", true);
                 * bite();
                 */
            }

            if (Input.GetKeyUp(KeyCode.R) && isAttacking)
            {
                isAttacking = false;
                animator.SetBool("Bite", false);
            }

            //Coup de queue
            if (Input.GetKeyDown(KeyCode.T))
            {
                if ((animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashLeft) || (animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashStayLeft) || (animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashJumpLeft))
                {
                    isAttacking = true;
                    animator.SetBool("TailStrokeLeft", true);
                    tail(-1);
                }
                else if ((animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashRight) || (animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashStayRight) || (animator.GetCurrentAnimatorStateInfo(0).shortNameHash == hashJumpRight))
                {
                    isAttacking = true;
                    animator.SetBool("TailStrokeRight", true);
                    tail(1);
                }
            }

            if (Input.GetKeyUp(KeyCode.T) && isAttacking)
            {
                isAttacking = false;
                animator.SetBool("TailStrokeLeft", false);
                animator.SetBool("TailStrokeRight", false);
            }

            if (Input.GetKeyDown(KeyCode.Space))
            {
                //Instantiate(aBomb, transform.position, transform.rotation);
            }

            if (timeFall >= deathLimit)
            {
                animator.SetBool("Wait", false);
                transform.position = position_ini;
                death++;
                m_Master.morts = death;
                m_Master.mortsT++;
                animator.SetBool("Dead", false);
            }
        }
        if (!alive)
        {
            StartCoroutine("Die");
            //death++;
        }

        if (Time.time > time_die + 2 * tps_die)
        {
            bol_die = true;
        }



        // Scores
        m_Master       = GameMaster.m_Instance;
        m_Master.tps  += Time.deltaTime;
        m_Master.tpsT += Time.deltaTime;
    }
Пример #46
0
 void Start()
 {
     gameMaster         = GameObject.Find("GameMaster").GetComponent <GameMaster>();
     cameraOrieantator  = GameObject.Find("CameraOrientator");
     unitSpeedToRestore = unitsPerSecond;
 }
Пример #47
0
 // Update is called once per frame
 void Update()
 {
     fishText.text = GameMaster.GetFishCount().ToString();
 }
Пример #48
0
    void Start()
    {
        devLog = GameObject.Find(customStrings.devConsole).GetComponent <DevLog>();

        gm = GameObject.FindGameObjectWithTag(customTags.GameMaster).GetComponent <GameMaster>();
    }
Пример #49
0
    public override void DommagePerso(int dommage)
    {
        if (!ennemiStats.immortel)
        {
            ennemiStats.immortel = true;
            StartCoroutine(ChangeImmortel());
            ennemiStats.vie -= dommage;

            if (ennemiStats.vie <= 0)
            {
                if (smokeSet == true)
                {
                    foreach (Transform child in transform)
                    {
                        if (child.tag == "SmokeEffect")
                        {
                            child.GetComponent <ParticleSystem>().Stop();
                            child.SetParent(null, false);
                            break;
                        }
                    }
                }

                //  m_fumer est false seulement pour les boss qui rotation, il explose déjà
                if (m_fumer == true)
                {
                    GameMaster gm = GameObject.Find("_GM").GetComponent <GameMaster>();
                    GameObject ex = Instantiate(gm.m_explosionEnnemis, transform.position, transform.rotation);
                    if (FindObjectOfType <AudioManager>() != null)
                    {
                        FindObjectOfType <AudioManager>().Play("SmallExplosion");
                    }

                    Sequence explose = DOTween.Sequence();
                    explose.SetDelay(1.0f);
                    explose.AppendCallback(() =>
                    {
                        Destroy(ex);
                    });
                    explose.Play();
                }

                GameMaster.KillEnnemi(this);
                return;
            }

            if (FindObjectOfType <AudioManager>() != null)
            {
                FindObjectOfType <AudioManager>().Play("HurtEnnemi");
            }

            if (GetComponent <Dommage_Shader>() != null)
            {
                GetComponent <Dommage_Shader>().CouleurDommage();
            }
            else if (m_mask != null)
            {
                m_mask.alphaCutoff = ((float)ennemiStats.vie / (float)ennemiStats.vieMax);
            }

            if (ennemiStats.vie <= (ennemiStats.vieMax / 2.0f) && smokeSet == false)
            {
                GameMaster gm = GameObject.Find("_GM").GetComponent <GameMaster>();
                Instantiate(gm.m_smokeEffect, transform.position, Quaternion.Euler(-90.0f, 0.0f, 0.0f), transform);
                smokeSet = true;
            }

            //Debug.Log("pourcentage de vie restant = " + ((float)ennemiStats.vie / (float)ennemiStats.vieMax));

            //m_mask.alphaCutoff = ((float)ennemiStats.vie / (float)ennemiStats.vieMax);
        }
    }
Пример #50
0
 // Update is called once per frame
 void Update()
 {
     wave_val     = GameMaster.getwave();
     wavetxt.text = "Wave: " + wave_val;
 }
 private void Start()
 {
     gm = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>();
     transform.position = gm.lastCheckPos;
 }
Пример #52
0
 void Start()
 {
     gm     = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>();
     _poitP = GetComponent <CheckPoint>();
 }
Пример #53
0
 public void LoadMainMenu()
 {
     GameMaster.ChangeGameState(GameMaster.GameState.MainMenu);
     SceneManager.LoadScene(0);
 }
Пример #54
0
    private string startText; //holder for label set in inspector

    void Start()
    {
        gm        = FindObjectOfType <GameMaster>(); //assign gamemaster to holder
        text      = GetComponent <Text>();           //assign ui text to holder
        startText = text.text;                       //copy label text to holder
    }
Пример #55
0
 static GameController()
 {
     testGameMaster = GameUser.CreateGameMaster("test");
 }
 private void Start()
 {
     gameMaster = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>();
     door2Open  = false;
 }
Пример #57
0
    void OnMouseDown()
    {
        if (IsDisabledStartAnimation)
        {
            return;
        }
        if (IsDisabled)
        {
            return;
        }

        if (!isClone)
        {
            ScoreBoard scoreBoard = GameMaster.GetScoreBoard();
            if (scoreBoard != null)
            {
                bool isCloneAllowed = scoreBoard.IsCloneAllowed(this.gameObject);
                if (!isCloneAllowed)
                {
                    var draggable = this.gameObject.GetComponent <Draggable>();
                    var baseGate  = this.gameObject.GetComponent <BaseGate>();
                    baseGate.IsDisabled      =
                        draggable.IsDisabled = true; // ei luba liigutada viimast elementi
                    return;
                }
                else
                {
                    var draggable = this.gameObject.GetComponent <Draggable>();
                    var baseGate  = this.gameObject.GetComponent <BaseGate>();
                    if (baseGate != null)
                    {
                        baseGate.IsDisabled = false;
                    }
                    if (draggable != null)
                    {
                        draggable.IsDisabled = false;
                    }
                }
            }
            GameObject clone;
            isClone = true;
            clone   = Instantiate(this.gameObject, this.gameObject.transform.position, transform.rotation) as GameObject;
            if (clone != null)
            {
                clone.transform.parent = this.transform.parent;
                if (clone.GetComponent <Renderer>() != null)
                {
                    var nameVar = clone.GetComponent <Renderer>().material.name;// uniti cloonimise kiiks. kui ei küsi siis ei clooni
                }
                clone.transform.localScale = transform.localScale;
                foreach (Transform child in clone.transform)
                {
                    if (child.GetComponent <Renderer>() != null)
                    {
                        var childName = child.GetComponent <Renderer>().material.name;
                    }
                }
            }
            this.gameObject.tag = AfterClonTagName;
            var redDot = this.transform.Find("nr_BG");
            if (redDot != null)
            {
                Destroy(redDot.gameObject);
            }
        }
    }
Пример #58
0
 public InitialisingExperiment(GameMaster gm) : base(gm)
 {
     stateName = STATE.INITIALISING_EXPERIMENT;
 }
Пример #59
0
 private void SetInitialReferences()
 {
     gameMaster = GetComponent <GameMaster>();
 }
Пример #60
0
 private void OnEnable()
 {
     gm = GameObject.FindGameObjectWithTag("GM").GetComponent <GameMaster>();
     MenuSystem.onDifficultyChange += SetDifficulty;
 }