Esempio n. 1
0
    public void OnDeathDefault()
    {
        if (GetType() == typeof(PlayerScript))
        {
            GameObject explPrefab = Resources.Load <GameObject> ("PowerIcons/ExploDeath");
            GameObject g          = Instantiate(explPrefab) as GameObject;
            g.transform.position = transform.position;
        }

        if (gameStartup == null)
        {
            gameStartup = Camera.main.GetComponent <GameStartup> ();
        }
        if (gameStartup.easyMode)
        {
            if (lifeCountText == null)
            {
                lifeCountText = GameObject.FindGameObjectWithTag("PowerUI").transform.FindChild("LifeCount").GetComponent <Text> ();
            }
            lifeCount--;
            lifeCountText.text = lifeCount.ToString();
            if (lifeCount <= 0)
            {
                EndLevel();
            }
        }
        else
        {
            EndLevel();
        }
    }
Esempio n. 2
0
    IEnumerator End()
    {
        yield return(new WaitForSeconds(time));

        GameStartup startup = Camera.main.GetComponent <GameStartup> ();

        CreateEndLevelObj(SceneManager.GetActiveScene().name, startup.easyMode ? Completion.FINISHED_EASY : Completion.FINISHED);
        SpawnEndAnim(Color.white);
        yield return(new WaitForSeconds(0.7f));

        SceneManager.LoadScene("DeathScreen");
    }
Esempio n. 3
0
    public override void EffectStart()
    {
        GameStartup startup = Camera.main.gameObject.GetComponent <GameStartup> ();
        Color       c       = GameObject.FindGameObjectWithTag("Player").GetComponent <MeshRenderer> ().material.color;

        for (int i = 0; i < startup.obstacles.Count; i++)
        {
            GameObject o          = startup.obstacles [i] as GameObject;
            float      obsStartAt = o.GetComponent <GameObstacle> ().startAtTime;
            if ((startup.startTime + obsStartAt) > Time.time && (startup.startTime + obsStartAt) < Time.time + effectDuration)
            {
                o.GetComponent <GameObstacle> ().SetColor(c);
            }
        }
    }
Esempio n. 4
0
    GameObject Split(UpLine other)
    {
        //add 100 points and split the line (destriy the current one, create a smaller one a the right place and change color of the upline)
        GameStartup startup = Camera.main.GetComponent <GameStartup>();

        startup.score += 100;
        GetComponent <Mover> ().goUp = false;
        GameObject miniLine = GameStartup.SpawnDownline(size - other.size);

        miniLine.GetComponent <DownLine> ().isSecondary = true;
        miniLine.transform.position = other.transform.position + new Vector3(0f, P.pocP(other.size + (size - other.size), Side.H), 0f);
        //miniLine.GetComponent<SpriteRenderer> ().color = Color.red;

        transform.localScale = other.transform.localScale;
        transform.position   = other.transform.position;
        return(miniLine);
    }
Esempio n. 5
0
    void CountPoints(UpLine other)
    {
        //count point and add malus if necessary
        other.SetColor(Color.gray);
        GameStartup startup  = Camera.main.GetComponent <GameStartup>();
        int         addScore = (int)((size / other.size) * 100);

        startup.score += addScore;
        if (addScore < 60)
        {
            startup.AddMalus();
            StartCoroutine(startup.SpawnExploLine(other.transform.position.y, other.size, Color.red));
        }
        else if (isSecondary && addScore > 60)
        {
            startup.score += (int)((size / other.size) * 100);
            //TODO spawn explo jaune sur le trait
            StartCoroutine(startup.SpawnExploLine(other.transform.position.y, other.size, Color.yellow));
        }

        GetComponent <Mover> ().goUp = false;
        transform.position           = other.transform.position - new Vector3(0f, P.pocP(other.size - size, Side.H), 0f);
    }
Esempio n. 6
0
    // Start is called before the first frame update
    void Start()
    {
        var gameStartup = new GameStartup();

        audioService = gameStartup.AudioLocator.AudioService;
    }
    // Use this for initialization
    void Start()
    {
        //Spawns all characters that have been selected, as the players in the order they were selected.
        charSelection = GameObject.Find("CharacterSelectManager").GetComponent <GameStartup>();
        for (int i = 1; i <= 4; i++)
        {
            if (charSelection.playerChoices[i] <= 0)
            {
                break;
            }

            Transform  playerChar;
            GameObject LRWeapon;
            Transform  playergui;
            playergui = Instantiate(gui, new Vector3(0, 0, 0), Quaternion.identity) as RectTransform;


            switch (charSelection.playerChoices [i])
            {
            case 1:             //Heavy
            {
                playerChar = Instantiate(heavy, GameObject.Find("Player_HeavySpawnPoint").transform.position, Quaternion.identity) as Transform;
                PlayerCharacter heavyscript = playerChar.GetComponent <HeavyScript>();
                LRWeapon = (GameObject)Instantiate(heavyLRweapon, heavyscript.RightHand.position, Quaternion.identity);
                GunStats gunstats = LRWeapon.GetComponentInChildren <GunStats>();
                LRWeapon.transform.parent = heavyscript.RightHand;                         //attach the weapon to the right hand

                //initialising hand IK targets
                heavyscript.LRWeapon    = LRWeapon;
                heavyscript.LHandPos    = gunstats.LHandPos;
                heavyscript.RHandPos    = gunstats.RHandPos;
                heavyscript.shot_source = gunstats.bulletSpawn;

                //Sets up GUI
                playergui.gameObject.GetComponent <PlayerHUD>().character = heavyscript;
                playergui.gameObject.GetComponent <PlayerHUD>().setPortraitHeavy();
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(1, "Shield Buff");
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(2, "Taunt");
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(3, "Ground Pound");
            }
            break;

            case 2:             //Commander
            {
                playerChar = Instantiate(commander, GameObject.Find("Player_CommanderSpawnPoint").transform.position, Quaternion.identity) as Transform;
                PlayerCharacter commanderscript = playerChar.GetComponent <CommanderScript>();
                LRWeapon = (GameObject)Instantiate(commanderLRweapon, commanderscript.RightHand.position, Quaternion.identity);
                GunStats gunstats = LRWeapon.GetComponentInChildren <GunStats>();
                LRWeapon.transform.parent = commanderscript.RightHand;                         //attach the weapon to the right hand


                //initialising hand IK targets
                commanderscript.LRWeapon    = LRWeapon;
                commanderscript.LHandPos    = gunstats.LHandPos;
                commanderscript.RHandPos    = gunstats.RHandPos;
                commanderscript.shot_source = gunstats.bulletSpawn;

                //Sets up GUI
                playergui.gameObject.GetComponent <PlayerHUD>().character = commanderscript;
                playergui.gameObject.GetComponent <PlayerHUD>().setPortraitCommander();
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(1, "Team Buff");
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(2, "Team Heal");
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(3, "Rage Attack");
            }
            break;

            case 3:             //Ninja
            {
                playerChar = Instantiate(ninja, GameObject.Find("Player_NinjaSpawnPoint").transform.position, Quaternion.identity) as Transform;
                PlayerCharacter ninjascript = playerChar.GetComponent <NinjaScript>();

                // Sets up GUI
                playergui.gameObject.GetComponent <PlayerHUD>().character = ninjascript;
                playergui.gameObject.GetComponent <PlayerHUD>().setPortraitNinja();
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(1, "Dodge");
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(2, "Invisibility");
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(3, "Coup de Graçe");
            }
            break;

            case 4:             //Sniper
            {
                playerChar = Instantiate(sniper, GameObject.Find("Player_SniperSpawnPoint").transform.position, Quaternion.identity) as Transform;
                PlayerCharacter sniperscript = playerChar.GetComponent <SniperScript>();
                LRWeapon = (GameObject)Instantiate(sniperLRweapon, sniperscript.RightHand.position, Quaternion.identity);
                GunStats gunstats = LRWeapon.GetComponentInChildren <GunStats>();
                LRWeapon.transform.parent = sniperscript.RightHand;                         //attach the weapon to the right hand


                //initialising hand IK targets
                sniperscript.LRWeapon    = LRWeapon;
                sniperscript.LHandPos    = gunstats.LHandPos;
                sniperscript.RHandPos    = gunstats.RHandPos;
                sniperscript.shot_source = gunstats.bulletSpawn;

                //Sets up GUI
                playergui.gameObject.GetComponent <PlayerHUD>().character = sniperscript;
                playergui.gameObject.GetComponent <PlayerHUD>().setPortraitSniper();
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(1, "Sniper Zoom");
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(2, "Evil Laugh");
                playergui.gameObject.GetComponent <PlayerHUD>().setCooldownName(3, "M3GA B34M");
                Transform scope = Instantiate(sniperscope, new Vector3(0, 0, 0), Quaternion.identity) as RectTransform;
                scope.GetComponent <Canvas>().worldCamera = GameObject.Find("Scopecam").camera;
            }
            break;

            default: playerChar = null; break;
            }

            //Adds controller to character for the appropriate player number
            playerChar.gameObject.AddComponent("Controller" + i);
            cam[i - 1] = playerChar.gameObject.GetComponentInChildren <Camera> ();


            playergui.GetComponent <Canvas>().worldCamera = cam[i - 1];

            //Sets up split screen depending on how many players are playing.
            if (cam[0] && cam[1] && cam[2] && cam[3])
            {
                //Debug.Log ("Doing 4 cameras");
                cam[0].rect = new Rect(0f, 0.5f, 0.5f, 0.5f);
                cam[1].rect = new Rect(0.5f, 0.5f, 0.5f, 0.5f);
                cam[2].rect = new Rect(0f, 0f, 0.5f, 0.5f);
                cam[3].rect = new Rect(0.5f, 0f, 0.5f, 0.5f);
            }

            else if (cam[0] && cam[1] && cam[2])
            {
                //Debug.Log ("Doing 3 cameras");
                cam[0].rect = new Rect(0f, 0.5f, 1f, 0.5f);
                cam[1].rect = new Rect(0f, 0f, 0.5f, 0.5f);
                cam[2].rect = new Rect(0.5f, 0f, 0.5f, 0.5f);
            }

            else if (cam[0] && cam[1])
            {
                //Debug.Log ("Doing 2 cameras");
                cam[1].rect = new Rect(0f, 0f, 1f, 0.5f);
                cam[0].rect = new Rect(0f, 0.5f, 1f, 0.5f);
            }

            else
            {
            }
        }
    }
Esempio n. 8
0
    public static void Main(string[] args)
    {
        // When a debugger is attached, immediately rethrow unobserved exceptions from asynchronous tasks
        if (Debugger.IsAttached)
        {
            TaskScheduler.UnobservedTaskException += (_, eventArgs) =>
            {
                if (!eventArgs.Observed)
                {
                    throw eventArgs.Exception;
                }
            };
        }
        else
        {
            AppDomain.CurrentDomain.UnhandledException += HandleException;
        }

        if (JumpListHandler.Handle(args))
        {
            return;
        }

        if (args.Length > 0 && args[0] == "--extract-save")
        {
            ExtractSaveArchive.Main(args.Skip(1).ToArray());
            return;
        }

        if (args.Length == 2 && args[0] == "--mes-to-json")
        {
            var mesContent = MesFile.Read(args[1]);
            var newFile    = Path.ChangeExtension(args[1], ".json");
            var options    = new JsonSerializerOptions();
            options.WriteIndented = true;
            var jsonContent = JsonSerializer.Serialize(mesContent.ToDictionary(
                                                           kvp => kvp.Key.ToString(),
                                                           kvp => kvp.Value
                                                           ), options);
            File.WriteAllText(newFile, jsonContent);
            return;
        }

        if (args.Length > 0 && args[0] == "--dump-addresses")
        {
            var dumper = new AddressDumper();
            dumper.DumpAddresses();
            return;
        }

        string dataDir = null;

        if (args.Length > 0 && args[0] == "--data-dir")
        {
            dataDir = args[1];
        }

        using var startup = new GameStartup { DataFolder = dataDir };

        if (startup.Startup())
        {
            startup.EnterMainMenu();

            Globals.GameLoop.Run();
        }
    }