Inheritance: MonoBehaviour
Exemplo n.º 1
0
 private void OnEnable()
 {
     lifeBar             = GetComponent <PlayerData>().GetPlayerLifeBar().GetComponent <LifeBar>();
     currentHealth       = getMaxHealth();
     dead                = false;
     lifeBar.lifePercent = 1.0f;
 }
Exemplo n.º 2
0
        /// <summary>
        /// State Game class constructor.
        /// </summary>
        public StateGame(Player player, GameData data) : base(StateID.Game)
        {
            //Initialize variable
            m_Data          = data;
            m_Player        = player;
            m_Victory       = false;
            m_Initialized   = false;
            m_ReadyToUpdate = false;
            m_BoardWidth    = 0;
            m_BoardHeight   = 0;
            m_IteratorStack = new Stack <int>();
            m_ShipStack     = new Stack <Ship>();
            m_VisitedList   = new List <GameData>();

            //Empties variables
            m_Depth        = 0;
            m_MaxDepth     = 0;
            m_Sky          = null;
            m_Actor        = null;
            m_King         = null;
            m_Ships        = null;
            m_Board        = null;
            m_SkyLayer     = null;
            m_BirdsView    = null;
            m_ActiveCamera = null;
            m_Controlled   = null;
            m_LifeBar      = null;
            m_Timer        = null;
        }
Exemplo n.º 3
0
        public override void Initialize()
        {
            pad = new HexPad(Content, ExhibeatSettings.WindowWidth / 2, ExhibeatSettings.WindowHeight / 2);
            pad.Initialize();
            pad.CenteredOrigin = true;
            pad.Scale          = 1;

            grades  = new NoteGradeDisplay(Content);
            lifebar = new LifeBar(Content, 30, 30);

            mapReader = new MapReader();
            mapReader.Initialize(Content);
            mapReader.RegisterNewReciever(pad);

            mapReader.Read("test.exi");
            mapReader.Play();

            mapReader.RegisterNewReciever(this);

            visualizer = new Visualizer(Content, 0, 0, 0, ExhibeatSettings.WindowHeight / 4, 30);
            mapReader.RegisterNewReciever(visualizer);

            //runner = new AnimatedSprite(Content.Load<Texture2D>("running-test"), Content.Load<SpriteSheet>("running-test-sheet"), new Vector2(100, 100), false);
            //runner.Position = new Vector2(0, 0/* ExhibeatSettings.WindowHeight - Content.Load<Texture2D>("running-test").Height / 2*/);

            background      = Content.Load <Texture2D>("blueWP");
            background_dest = new Rectangle(0, 0, ExhibeatSettings.WindowWidth, ExhibeatSettings.WindowHeight);

            base.Initialize();
        }
Exemplo n.º 4
0
 void Start()
 {
     //lifeBarをオブジェクトの子として取得、基本は非表示(被ダメージ時表示)
     lifeBar = GetComponentInChildren <LifeBar>();
     LifeBar.SetActive(false);
     //被ダメージ時にtrueに返す
     DamageSet = false;
     //敵HP初期値設定(最大)
     armorPoint = armorPointMax;
     // Animator取得
     animator = GetComponent <Animator>();
     // 被ダメージ時の点滅処理(ModelColorChange参照)
     modelColorChange = gameObject.GetComponent <ModelColorChange>();  
     // Playerタグが付いているオブジェクトをターゲットにする
         target = GameObject.FindWithTag("Player");
     // Playerタグが付いているオブジェクトのPlayerLevelをplayerLevelとする
     playerLevel = GameObject.FindWithTag("Player").GetComponent <PlayerLevel> ();
     // BattleManagerオブジェクトのBattleManagerをbattleManagerとする
     battleManager = GameObject.Find("BattleManager").GetComponent <BattleManager> ();
     // レイヤーをEnemyにしておく(被ダメージ時、死亡処理時使用)
     gameObject.layer = LayerMask.NameToLayer("Enemy");
     // Rigidbodyを取得し、以後rbと略す
     rb = this.GetComponent <Rigidbody>();
     // 重力を個別に設定する場合場合はデフォルト設定時のGravity設定を無効にする
     rb.useGravity = false;
 }
Exemplo n.º 5
0
 public void SetupReferences()
 {
     // Setting up references.
     playerControl  = GetComponent <PlayerController>();
     anim           = GetComponentInChildren <Animator>();
     lifeBar        = GameObject.FindGameObjectWithTag("LifeBar").GetComponent <LifeBar>();
     startingHealth = health;
 }
Exemplo n.º 6
0
    protected override void SetupLifeBar()
    {
        const float PLAYERMAXSTARTINGLIFE = 100;
        Image       barreVie = GameObject.FindGameObjectWithTag("viePleine").GetComponent <Image>();

        barreDeVie          = new LifeBar(barreVie, PLAYERMAXSTARTINGLIFE);
        onDieMainPlayerHook = new OnDieMainPlayerHook(this);
    }
Exemplo n.º 7
0
    void Awake()
    {
        instance = this;

        if (GameObject.Find("Health") != null)
        {
            healthBar = GameObject.Find("Health").GetComponent <Slider>();
        }
    }
Exemplo n.º 8
0
 void GetNonStandardUI()
 {
     addNew      = GetComponentInChildren <AddNewGuitarist>(true);
     soloMeter   = GetComponentInChildren <SoloMeter>(true);
     worldShader = GetComponentInChildren <WorldShader>();
     score       = GetComponentInChildren <ScoreBoard>();
     addScore    = GetComponentInChildren <ScoreGrow>(true);
     lifeBar     = GetComponentInChildren <LifeBar>();
 }
Exemplo n.º 9
0
    /// <summary>
    ///  Finds the current life bar object and stores it inside the player status
    /// </summary>
    public void Init(InitStatus initStatus)
    {
        if (initStatus == InitStatus.UNKNOWN)
        {
            return;
        }

        this.lifeBar = this.InstantiateLifeBarForPlayer(initStatus);
        this.lifeBar.gameObject.SetActive(true);
    }
Exemplo n.º 10
0
    protected override void Start()
    {
        //Physics.gravity = new Vector3(0, -200, 0);
        GetComponent <Rigidbody>().drag = 20;

        monsterMask = 1 << LayerMask.NameToLayer("Monster");
        life        = GameObject.Find("Life").GetComponent <LifeBar>();

        StartCoroutine(SwingAttack());
    }
Exemplo n.º 11
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 12
0
    protected virtual void Start()
    {
        GameObject lifeBarPrefab = Resources.Load <GameObject>("Prefabs/LifeBar");

        GameObject lifeBarInst = Instantiate(lifeBarPrefab, transform.position, Quaternion.identity);

        lifeBarInst.transform.parent = transform;

        lifeBar = lifeBarInst.GetComponent <LifeBar>();

        lifeBar.SetTotalLife(currentLife);
    }
Exemplo n.º 13
0
    // Use this for initialization
    void Start()
    {
        m_spawn.m_liveEnemy++;

        GameManager.Instance.m_EnemyList.Add(this);

        // 创建生命条
        Transform obj = (Transform)Instantiate(m_lifeBarObject, this.transform.position, Quaternion.identity);

        m_bar = obj.GetComponent <LifeBar>();
        m_bar.Ini(m_life, m_maxlife, 2, 0.2f);
    }
Exemplo n.º 14
0
 // Update is called once per frame
 protected override void Update()
 {
     if (EnemyHP == EnemyHPMax)
     {
         LifeBar.GetComponent <RectTransform>().sizeDelta = new Vector2(30, 2.5f);
     }
     else
     {
         LifeBar.GetComponent <RectTransform>().sizeDelta = new Vector2(((EnemyHP * 100 / EnemyHPMax) / 100) * 30, 2.5f);
     }
     base.Update();
 }
Exemplo n.º 15
0
    private void SpwanLifeBar(Canvas canvas)
    {
        GameObject prefab = Resources.Load <GameObject>("LifeBar");

        _bar = Instantiate(prefab, canvas.transform).AddComponent <LifeBar>();
        List <LifeBarData> data = new List <LifeBarData>();

        data.Add(new LifeBarData(null, Color.green));
        data.Add(new LifeBarData(null, Color.red));
        data.Add(new LifeBarData(null, Color.yellow));
        _bar.Init(transform, 350, data);
    }
Exemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     lifeBar      = GameObject.Find("LifeBar").GetComponent <LifeBar>();
     storeManager = GameObject.Find("StoreText").GetComponent <StoreManager>();
     if (StoreManager.ItemsSold[(int)item])
     {
         GetComponentInChildren <Text>().text = item.ToString() + " SOLD";
     }
     else
     {
         GetComponentInChildren <Text>().text = "BUY " + item.ToString() + ": " + price;
     }
 }
Exemplo n.º 17
0
    private void SpawnLifeBar(Canvas canvas)
    {
        GameObject prefab = Resources.Load <GameObject>("LifeBar");

        _bar = Instantiate(prefab, canvas.transform).AddComponent <LifeBar>();
        List <LifeBarData> data = new List <LifeBarData>()
        {
            new LifeBarData(null, Color.red),
            new LifeBarData(null, Color.yellow),
            new LifeBarData(null, Color.blue)
        };

        _bar.init(transform, 350, data);
    }
Exemplo n.º 18
0
    protected override void Update()
    {
        float percentHealh = ((EnemyHP * 100 / EnemyHPMax) / 100) * ScaleOnStart;

        transform.localScale = new Vector3(percentHealh, percentHealh, percentHealh);
        if (EnemyHP == EnemyHPMax)
        {
            LifeBar.GetComponent <RectTransform>().sizeDelta = new Vector2(60, 3.5f);
        }
        else
        {
            LifeBar.GetComponent <RectTransform>().sizeDelta = new Vector2(((EnemyHP * 100 / EnemyHPMax) / 100) * 60, 3.5f);
        }
        base.Update();
    }
Exemplo n.º 19
0
    void Start()
    {
        float   distance  = transform.position.z - Camera.main.transform.position.z;
        Vector3 leftmost  = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, distance));
        Vector3 rightmost = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, distance));
        Vector3 topmost   = Camera.main.ViewportToWorldPoint(new Vector3(0, 1, distance));

        xmin          = leftmost.x + padding;
        xmax          = rightmost.x - padding;
        ymin          = leftmost.y + padding;
        ymax          = topmost.y - padding;
        thruster      = FindObjectOfType <Thruster>();
        lifeBar       = FindObjectOfType <LifeBar>();
        myAudioSource = GetComponent <AudioSource>();
    }
Exemplo n.º 20
0
        public void LoadContent(ContentManager content, GraphicsDevice graphicsDevice)
        {
            txtBoxWaves  = new TextBox(new Vector2(Game1.ViewPortWidth - 147, Game1.ViewPortHeight - 39), 137, 29, 1, Color.Black * 0.39f, new Color(98, 0, 0), "Waves: " + SpawnManager.WaveCount, @"Fonts\HUDFont");
            boxLifeBars  = new Box(new Vector2(10, Game1.ViewPortHeight - 54), 162, 44, 1, Color.Black * 0.39f, new Color(98, 0, 0), graphicsDevice);
            lfbHealthBar = new LifeBar(new Vector2(28, Game1.ViewPortHeight - 45), playerRef.myShip.Health, @"Sprites\GUI\Health-Bar");
            lfbShieldBar = new LifeBar(new Vector2(28, Game1.ViewPortHeight - 29), playerRef.myShip.Shield, @"Sprites\GUI\Shield-Bar");

            guiSystem.Add(txtBoxScore);
            guiSystem.Add(txtBoxFlamoca);
            guiSystem.Add(txtBoxWaves);
            guiSystem.Add(boxLifeBars);
            guiSystem.Add(lfbHealthBar);
            guiSystem.Add(lfbShieldBar);

            guiSystem.LoadContent(content, graphicsDevice);
        }
Exemplo n.º 21
0
        public override void Load() //hooking time!
        {
            introText       = new IntroText();
            customResources = new UserInterface();
            customResources.SetState(introText);

            lifeBar            = new LifeBar();
            customResourcesBar = new UserInterface();
            customResourcesBar.SetState(lifeBar);

            On.Terraria.Player.Update_NPCCollision += PlatformCollision;
            On.Terraria.Main.DrawInterface         += DrawBlingBlingBoy;
            On.Terraria.Player.PlaceThing          += PlacementRestriction;

            IL.Terraria.Projectile.VanillaAI += GrapplePlatforms;
            IL.Terraria.Main.DoDraw          += DrawWater;
        }
Exemplo n.º 22
0
 protected override void Update()
 {
     if (EnemyHP == EnemyHPMax)
     {
         LifeBar.GetComponent <RectTransform>().sizeDelta = new Vector2(30, 2.5f);
     }
     else
     {
         LifeBar.GetComponent <RectTransform>().sizeDelta = new Vector2(EnemyHP / EnemyHPMax * 30, 2.5f);
     }
     base.Update();
     ArmorBarManagment();
     if (Armor <= 0)
     {
         Slowable = true;
     }
 }
Exemplo n.º 23
0
    public void RegisterPlayer(PlayerController player)
    {
        LifeBar bar = null;

        if (barsByPlayer.ContainsKey(player.ControllerId))
        {
            bar = barsByPlayer[player.ControllerId];
        }
        else
        {
            bar = Instantiate <LifeBar>(lifeBarPrefab, lifeBarHolder, false);
            bar.SetPlayer(player.ControllerId, playerColors);
            barsByPlayer.Add(player.ControllerId, bar);
        }
        player.GetComponent <Life>().OnChange += (oldRatio, newRatio) => bar.SetLifeRatio(newRatio);

        // TODO: do something on death too.
    }
Exemplo n.º 24
0
    private void DealDamage(Collider other)
    {
        Shield shield = other.GetComponentInChildren <Shield>();

        if (shield.IsBlocking())
        {
            shield.damageShield(GetCurrentAttack().damage);
        }
        else
        {
            LifeBar lifeBar = other.GetComponent <LifeBar>();
            lifeBar.TakeDamage(GetCurrentAttack().damage);

            CarryBattery battery = other.GetComponent <CarryBattery> ();

            if (battery != null)
            {
                battery.DropBattery();
            }
        }
    }
Exemplo n.º 25
0
        /// <summary>
        /// Create game's graphical interface.
        /// </summary>
        private void CreateGUI()
        {
            //If player
            if (m_Player == Player.Klotski || m_Player == Player.Storm)
            {
                //Create lifebar
                m_LifeBar      = new LifeBar(Global.GUIManager);
                m_LifeBar.Left = Global.LIFEBAR_X;
                m_LifeBar.Top  = Global.LIFEBAR_Y;
                m_LifeBar.Init();

                //Add it
                m_Panel.Add(m_LifeBar);
                Global.GUIManager.Add(m_LifeBar);
            }

            //If not editor
            if (m_Player != Player.Storm)
            {
                //Create timer
                m_Timer      = new Timer(Global.GUIManager);
                m_Timer.Left = Global.TIMER_X;
                m_Timer.Top  = Global.TIMER_Y;
                m_Timer.Init(Global.TIMER_FONT);

                //Create steps counter
                m_Counter      = new Counter(Global.GUIManager);
                m_Counter.Left = Global.COUNTER_X;
                m_Counter.Top  = Global.COUNTER_Y;
                m_Counter.Init(Global.COUNTER_FONT, m_Player != Player.Klotski);

                //Add it
                m_Panel.Add(m_Timer);
                m_Panel.Add(m_Counter);
                Global.GUIManager.Add(m_Timer);
                Global.GUIManager.Add(m_Counter);
            }
        }
Exemplo n.º 26
0
 // Use this for initialization
 protected override void Start()
 {
     m_isdead = false;
     rg       = GetComponent <Rigidbody>();
     trans    = GetComponent <Transform>();
     mainCam  = transform.GetChild(3).gameObject;
     Bar      = GameObject.Find("CurrentLife").transform.GetComponent <Image>();
     lifeBar  = GameObject.Find("LifeBar").transform.GetComponent <LifeBar>();
     life     = 10;
     if (!isLocalPlayer)
     {
         mainCam.SetActive(false);
         return;
     }
     for (int i = 0; i < GameManager.Instance.m_spawnPoints.Length; i++)
     {
         if (!GameManager.Instance.m_spawnPoints[i].GetComponent <Spawn>().GetSetIsTaken)
         {
             transform.position = GameManager.Instance.m_spawnPoints[i].transform.position;
             GameManager.Instance.m_spawnPoints[i].GetComponent <Spawn>().GetSetIsTaken = true;
             break;
         }
     }
 }
    // private PlayerController polarityModifierSwitch; // << TO DO to be implemented with player's ability to use enemy fire against them

    // Start is called before the first frame update
    void Start()
    {
        // Initialize references
        GameObject gameManagerObject = GameObject.FindWithTag("GameManager");

        gameManager = gameManagerObject.GetComponent <GameManager>();
        GameObject soundManagerObject = GameObject.FindWithTag("SoundManager");

        soundManager     = soundManagerObject.GetComponent <SoundManager>();
        enemyDamage      = GetComponent <DetectCollisions>();
        lifeBar          = FindObjectOfType <LifeBar>();
        playerController = FindObjectOfType <PlayerController>();
        speedBar         = FindObjectOfType <SpeedBar>();
        activeScene      = SceneManager.GetActiveScene();
        shieldCanvas     = FindObjectOfType <PlayerShieldCanvas>();
        shieldAnimation  = FindObjectOfType <ShieldAnimation>();
        // Initialize Life-Hit points and check for tutorial mode
        playerCurrentHitPoints = playerMaxHitPoints;
        lifeBar.SetMaxLife(playerCurrentHitPoints);
        //TutorialModeCheck();
        StartCoroutine(RegenerateHP());

        // polarityModifierSwitch = FindObjectOfType<PlayerController>(); // << TO DO to be implemented with player's ability to use return enemy fire
    }
Exemplo n.º 28
0
 public void Add(LifeBar guiLifeBar)
 {
     GuiLifeBarList.Add(guiLifeBar);
 }
Exemplo n.º 29
0
    // Use this for initialization
    void Start()
    {
        m_spawn.m_liveEnemy++;

        GameManager.Instance.m_EnemyList.Add(this);

        // ����������
        Transform obj=(Transform)Instantiate(m_lifeBarObject, this.transform.position, Quaternion.identity);
        m_bar = obj.GetComponent<LifeBar>();
        m_bar.Ini(m_life, m_maxlife, 2, 0.2f);
    }
Exemplo n.º 30
0
 // Use this for initialization
 void Start()
 {
     DetectGameSpace();
     lifeBar  = GameObject.FindObjectOfType <LifeBar>();
     animator = this.GetComponentInChildren <Animator>();
 }
Exemplo n.º 31
0
        public GameScreen(Manager manager)
        {
            base.manager = manager;

            if (Layout.ScreenFormat == ScreenFormat.Format4X3)
            {
                #region 4X3 format screen

                viewArea = new Rectangle(0, 0, 888, 728);

                Button camara = new Button(new Rectangle(910, 194, 32, 31), ChangeCamera, "camaraUp",
                                           "camaraDown", "camaraUp", Sprite.SpriteFont);

                Button misileCamera = new Button(new Rectangle(942, 193, 26, 31), ChangeMisileCamera, "misileCameraUp",
                                                 "misileCameraDown", "misileCameraUp", Sprite.SpriteFont);

                Button sound = new Button(new Rectangle(967, 195, 31, 31), SwitchSounds, "soundUp",
                                          "soundDown", "soundUp", Sprite.SpriteFont);

                Button menu = new Button(new Rectangle(900, 20, 109, 21), EnterMenuScreen, "menuNormal",
                                         "menuUp", "menuNormal", Sprite.SpriteFont);

                LifeBar playerLife = new LifeBar(Player.Person, base.manager.Game, new Rectangle(55, 739, 145, 18));

                LifeBar cpuLife = new LifeBar(Player.Computer, base.manager.Game, new Rectangle(705, 739, 145, 18));

                Label playerTurn = new Label(new Function(GetPlayerTurn), new Rectangle(900, 3, 111, 14), Sprite.SpriteFont, Aligment.Center);

                Label playerTurnDown = new Label(new Function(GetPlayerTurn), new Rectangle(357, 733, 174, 28), Sprite.SpriteFont, Aligment.Center);

                Panel downPanel = new Panel(new Rectangle(0, 728, 888, 40), "down", Aligment.Left);

                Panel panelRight = new Panel(new Rectangle(888, 0, 136, 768), "gameRight", Aligment.Left);

                Label lblPlayer = new Label(new FunctionParameter(GetPlayerName), Player.Person, new Rectangle(211, 739, 161, 14), Sprite.SpriteFont, Aligment.Left);

                Label lblCPU = new Label(new FunctionParameter(GetPlayerName), Player.Computer, new Rectangle(533, 739, 161, 14), Sprite.SpriteFont, Aligment.Right);

                Label lblFleet = new Label(Game.GameStrings.GetString("EnemyFleet"), new Rectangle(900, 232, 111, 14), Sprite.SpriteFont, Aligment.Center);

                Button cameraRotateLeft = new Button(new Rectangle(10, 70, 60, 40), "left", new MouseDown(MoveLeft));

                Button cameraRotateRight = new Button(new Rectangle(155, 70, 60, 40), "right", new MouseDown(MoveRight));

                Button cameraZoomIn = new Button(new Rectangle(75, 55, 75, 30), "zoom in", new MouseDown(ZoomIn));

                Button cameraZoomOut = new Button(new Rectangle(75, 90, 75, 30), "zoom out", new MouseDown(ZoomOut));

                Button cameraMoveUp = new Button(new Rectangle(75, 10, 75, 40), "Up", new MouseDown(MoveUp));

                Button cameraMoveDown = new Button(new Rectangle(75, 125, 75, 40), "Down", new MouseDown(MoveDown));

                AddControl(camara);
                AddControl(misileCamera);
                AddControl(sound);
                AddControl(menu);
                AddControl(playerLife);
                AddControl(cpuLife);
                AddControl(playerTurn);
                AddControl(playerTurnDown);
                AddControl(panelRight);
                AddControl(downPanel);
                AddControl(lblPlayer);
                AddControl(lblCPU);
                AddControl(lblFleet);
                AddControl(cameraRotateLeft);
                AddControl(cameraRotateRight);
                AddControl(cameraZoomIn);
                AddControl(cameraZoomOut);
                AddControl(cameraMoveUp);
                AddControl(cameraMoveDown);

                #endregion
            }
            else
            {
                #region 16X9 format screen

                viewArea = Layout.CalculateTotalLayout(new Rectangle(0, 0, 1144, 720));

                Button camara = new Button(Layout.CalculateTotalLayout(new Rectangle(1166, 182, 32, 29)), ChangeCamera, "camaraHover",
                                           "camaraDown", "camaraUp", Sprite.SpriteFont);

                Button misileCamera = new Button(Layout.CalculateTotalLayout(new Rectangle(1198, 181, 26, 29)), ChangeMisileCamera, "misileCameraUp",
                                                 "misileCameraDown", "misileCameraUp", Sprite.SpriteFont);

                Button sound = new Button(Layout.CalculateTotalLayout(new Rectangle(1223, 183, 31, 29)), SwitchSounds, "soundUp",
                                          "soundDown", "soundUp", Sprite.SpriteFont);

                Button menu = new Button(Layout.CalculateTotalLayout(new Rectangle(1156, 20, 109, 20)), EnterMenuScreen, "menuNormal",
                                         "menuUp", "menuNormal", Sprite.SpriteFont);

                LifeBar playerLife = new LifeBar(Player.Person, base.manager.Game, Layout.CalculateTotalLayout(new Rectangle(69, 691, 145, 18)));

                LifeBar cpuLife = new LifeBar(Player.Computer, base.manager.Game, Layout.CalculateTotalLayout(new Rectangle(953, 691, 145, 18)));

                Label playerTurn = new Label(new Function(GetPlayerTurn), Layout.CalculateTotalLayout(new Rectangle(1156, 2, 111, 14)), Sprite.SpriteFont, Aligment.Center);

                Label playerTurnDown = new Label(new Function(GetPlayerTurn), Layout.CalculateTotalLayout(new Rectangle(485, 693, 174, 14)), Sprite.SpriteFont, Aligment.Center);

                Panel downPanel = new Panel(Layout.CalculateTotalLayout(new Rectangle(0, 680, 1144, 40)), "down", Aligment.Left);

                Panel panelRight = new Panel(Layout.CalculateTotalLayout(new Rectangle(1144, 0, 136, 720)), "gameRight", Aligment.Left);

                Label lblPlayer = new Label(new FunctionParameter(GetPlayerName), Player.Person, Layout.CalculateTotalLayout(new Rectangle(224, 693, 161, 14)), Sprite.SpriteFont, Aligment.Left);

                Label lblCPU = new Label(new FunctionParameter(GetPlayerName), Player.Computer, Layout.CalculateTotalLayout(new Rectangle(782, 693, 161, 14)), Sprite.SpriteFont, Aligment.Right);

                Label lblFleet = new Label(Game.GameStrings.GetString("EnemyFleet"), Layout.CalculateTotalLayout(new Rectangle(1156, 218, 111, 13)), Sprite.SpriteFont, Aligment.Center);

                Button cameraRotateLeft = new Button(new Rectangle(10, 70, 60, 40), "left", new MouseDown(MoveLeft));

                Button cameraRotateRight = new Button(new Rectangle(155, 70, 60, 40), "right", new MouseDown(MoveRight));

                Button cameraZoomIn = new Button(new Rectangle(75, 55, 75, 30), "zoom in", new MouseDown(ZoomIn));

                Button cameraZoomOut = new Button(new Rectangle(75, 90, 75, 30), "zoom out", new MouseDown(ZoomOut));

                Button cameraMoveUp = new Button(new Rectangle(75, 10, 75, 40), "Up", new MouseDown(MoveUp));

                Button cameraMoveDown = new Button(new Rectangle(75, 125, 75, 40), "Down", new MouseDown(MoveDown));

                AddControl(camara);
                AddControl(misileCamera);
                AddControl(sound);
                AddControl(menu);
                AddControl(playerLife);
                AddControl(cpuLife);
                AddControl(playerTurn);
                AddControl(playerTurnDown);
                AddControl(panelRight);
                AddControl(downPanel);
                AddControl(lblPlayer);
                AddControl(lblCPU);
                AddControl(lblFleet);
                AddControl(cameraRotateLeft);
                AddControl(cameraRotateRight);
                AddControl(cameraZoomIn);
                AddControl(cameraZoomOut);
                AddControl(cameraMoveUp);
                AddControl(cameraMoveDown);

                #endregion
            }
        }
Exemplo n.º 32
0
    protected override void Start()
    {
        //Physics.gravity = new Vector3(0, -200, 0);
        GetComponent<Rigidbody>().drag = 20;

        monsterMask = 1 << LayerMask.NameToLayer("Monster");
        life = GameObject.Find("Life").GetComponent<LifeBar>();

        StartCoroutine(SwingAttack());
    }
Exemplo n.º 33
0
    //Start
    void Start()
    {
        //Data from option
        speedmod = DataManager.Instance.speedmodSelected*speedmodRate;
        DataManager.Instance.LoadScoreJudge(DataManager.Instance.scoreJudgeSelected);
        DataManager.Instance.LoadHitJudge(DataManager.Instance.hitJudgeSelected);
        DataManager.Instance.LoadLifeJudge(DataManager.Instance.lifeJudgeSelected);
        isFullComboRace = DataManager.Instance.raceSelected == 9;
        isFullExComboRace = DataManager.Instance.raceSelected == 10;
        targetScoreInverse = DataManager.Instance.giveTargetScoreOfRace(DataManager.Instance.raceSelected);
        typeOfDeath = DataManager.Instance.deathSelected;
        KeyCodeDown = DataManager.Instance.KeyCodeDown;
        KeyCodeUp = DataManager.Instance.KeyCodeUp;
        KeyCodeLeft = DataManager.Instance.KeyCodeLeft;
        KeyCodeRight = DataManager.Instance.KeyCodeRight;
        SecondaryKeyCodeDown = DataManager.Instance.SecondaryKeyCodeDown;
        SecondaryKeyCodeUp = DataManager.Instance.SecondaryKeyCodeUp;
        SecondaryKeyCodeLeft = DataManager.Instance.SecondaryKeyCodeLeft;
        SecondaryKeyCodeRight = DataManager.Instance.SecondaryKeyCodeRight;
        speedmodSelected = DataManager.Instance.speedmodSelected;
        speedmodstring = DataManager.Instance.speedmodSelected.ToString("0.00");
        speedmodok = true;
        var rand = (int)(UnityEngine.Random.value*DataManager.Instance.skyboxList.Count);
        if(rand == DataManager.Instance.skyboxList.Count){
            rand--;
        }

        //Arrows
        for(int i=0;i<4;i++){
            if(i != DataManager.Instance.skinSelected){
                var go = GameObject.Find("ArrowSkin" + i);
                Destroy(go);
                var go2 = GameObject.Find("ArrowModelSkin" + i);
                Destroy(go2);
            }
        }
        arrow = typeArrow.ElementAt(DataManager.Instance.skinSelected);
        var modelskin = GameObject.Find("ArrowModelSkin" + DataManager.Instance.skinSelected);
        modelskin.SetActiveRecursively(false);
        arrowLeft = (GameObject) Instantiate(modelskin, new Vector3(0f, 0f, 2f), modelskin.transform.rotation);
        if(DataManager.Instance.skinSelected == 3){
            arrowLeft.transform.FindChild("RotationCenter").Rotate(0f, 0f, 90f);
        }else if(DataManager.Instance.skinSelected != 0){
            arrowLeft.transform.Rotate(0f, 0f, 90f);
            arrowLeft.transform.FindChild("ParticulePrec").Rotate(0f, 0f, -90f);
            arrowLeft.transform.FindChild("ParticulePrec").localPosition = new Vector3(-1f, 0f, 0f);
        }

        arrowLeft.transform.parent = MainCamera.gameObject.transform;
        arrowRight = (GameObject) Instantiate(modelskin, new Vector3(6f, 0f, 2f), modelskin.transform.rotation);
        if(DataManager.Instance.skinSelected == 3){
            arrowRight.transform.FindChild("RotationCenter").Rotate(0f, 0f, -90f);
        }else if(DataManager.Instance.skinSelected == 1){
            arrowRight.transform.Rotate(0f, 0f, -90f);
            arrowRight.transform.FindChild("ParticulePrec").Rotate(0f, 0f, 90f);
            arrowRight.transform.FindChild("ParticulePrec").localPosition = new Vector3(1f, 0f, 0f);
        }
        arrowRight.transform.parent = MainCamera.gameObject.transform;
        arrowDown = (GameObject) Instantiate(modelskin, new Vector3(2f, 0f, 2f), modelskin.transform.rotation);
        if(DataManager.Instance.skinSelected == 3){
            arrowDown.transform.FindChild("RotationCenter").Rotate(0f, 0f, 180f);
        }else if(DataManager.Instance.skinSelected == 1){
            arrowDown.transform.Rotate(0f, 0f, 180f);
            arrowDown.transform.FindChild("ParticulePrec").Rotate(0f, 0f, -180f);
            arrowDown.transform.FindChild("ParticulePrec").localPosition = new Vector3(0f, 1f, 0f);
        }
        arrowDown.transform.parent = MainCamera.gameObject.transform;
        arrowUp = (GameObject) Instantiate(modelskin, new Vector3(4f, 0f, 2f), modelskin.transform.rotation);
        arrowUp.transform.parent = MainCamera.gameObject.transform;

        arrowTarget = new Transform[4];
        arrowTarget[0] = arrowLeft.transform;
        arrowTarget[1] = arrowDown.transform;
        arrowTarget[2] = arrowUp.transform;
        arrowTarget[3] = arrowRight.transform;
        scaleBase = arrowTarget[0].localScale.x;
        matArrowModel = matSkinModel[DataManager.Instance.skinSelected];

        RenderSettings.skybox = DataManager.Instance.skyboxList.ElementAt(rand);
        DataManager.Instance.skyboxIndexSelected = rand;
        displayValue = DataManager.Instance.displaySelected;

        firstArrow = -10f;
        lastArrow = -10f;
        thesong = DataManager.Instance.songSelected;
        songLoaded = thesong.GetAudioClip();
        audio.loop = false;
        createTheChart(thesong);
        Application.targetFrameRate = -1;
        QualitySettings.vSyncCount = 0;
        nextSwitchBPM = 1;
        nextSwitchStop = 0;
        actualBPM = thesong.bpms.First().Value;
        actualstop = (double)0;
        changeBPM = 0;

        _count = 0L;

        timebpm = (double)0;
        timechart = 0f;//-(float)thesong.offset;
        timetotalchart = (double)0;

        arrowFrozen = new Dictionary<Arrow, float>();

        precRight = new Dictionary<string, ParticleSystem>();
        precLeft = new Dictionary<string, ParticleSystem>();
        precUp = new Dictionary<string, ParticleSystem>();
        precDown = new Dictionary<string, ParticleSystem>();
        clearcombo = new Dictionary<string, ParticleSystem>();

        //Prepare the scene
        foreach(var el in Enum.GetValues(typeof(PrecParticle))){
            precLeft.Add( el.ToString(), (ParticleSystem) arrowLeft.transform.FindChild("ParticulePrec").gameObject.transform.FindChild(el.ToString()).particleSystem );
            precDown.Add( el.ToString(), (ParticleSystem) arrowDown.transform.FindChild("ParticulePrec").gameObject.transform.FindChild(el.ToString()).particleSystem );
            precRight.Add( el.ToString(), (ParticleSystem) arrowRight.transform.FindChild("ParticulePrec").gameObject.transform.FindChild(el.ToString()).particleSystem );
            precUp.Add( el.ToString(), (ParticleSystem) arrowUp.transform.FindChild("ParticulePrec").gameObject.transform.FindChild(el.ToString()).particleSystem );
        }
        for(int i=0; i< particleComboCam.transform.GetChildCount(); i++){
            clearcombo.Add(particleComboCam.transform.GetChild(i).name, particleComboCam.transform.GetChild(i).particleSystem);
        }

        precAverage = new List<double>();
        timeCombo = new Dictionary<double, int>();
        lifeGraph = new Dictionary<double, double>();

        TMainCamera = MainCamera.transform;
        MoveCameraBefore();

        //Textures
        TextureBase = new Dictionary<string, Texture2D>();
        TextureBase.Add("FANTASTIC", (Texture2D) Resources.Load("Fantastic"));
        TextureBase.Add("EXCELLENT", (Texture2D) Resources.Load("Excellent"));
        TextureBase.Add("GREAT", (Texture2D) Resources.Load("Great"));
        TextureBase.Add("DECENT", (Texture2D) Resources.Load("Decent"));
        TextureBase.Add("WAYOFF", (Texture2D) Resources.Load("Wayoff"));
        TextureBase.Add("MISS", (Texture2D) Resources.Load("Miss"));
        for(int i=0; i<10; i++){
            TextureBase.Add("S" + i, (Texture2D) Resources.Load("Numbers/S" + i));
            TextureBase.Add("C" + i, (Texture2D) Resources.Load("Numbers/C" + i));
        }

        TextureBase.Add("PERCENT", (Texture2D) Resources.Load("Numbers/Percent"));
        TextureBase.Add("DOT", (Texture2D) Resources.Load("Numbers/Dot"));
        TextureBase.Add("COMBODISPLAY", (Texture2D) Resources.Load("DisplayCombo"));
        TextureBase.Add("BLACK", (Texture2D) Resources.Load("black"));
        TextureBase.Add("FAIL", (Texture2D) Resources.Load("Fail"));
        TextureBase.Add("CLEAR", (Texture2D) Resources.Load("Clear"));
        TextureBase.Add("FC", (Texture2D) Resources.Load("FC"));
        TextureBase.Add("FEC", (Texture2D) Resources.Load("FEC"));
        TextureBase.Add("FFC", (Texture2D) Resources.Load("FFC"));
        TextureBase.Add("PERFECT", (Texture2D) Resources.Load("Perfect"));

        //stuff
        scoreToDisplay = Precision.NONE;
        timeDisplayScore = Mathf.Infinity;
        sensFantastic = true;
        alpha = 1f;
        scenechartfaded = false;

        //init score and lifebase
        scoreBase = new Dictionary<string, float>();
        scoreCount = new Dictionary<string, int>();
        lifeBase = new Dictionary<string, float>();
        fantasticValue = 100f/(thesong.numberOfStepsWithoutJumps + thesong.numberOfJumps + thesong.numberOfFreezes + thesong.numberOfRolls);
        foreach(Precision el in Enum.GetValues(typeof(Precision))){
            if(el != Precision.NONE){
                scoreBase.Add(el.ToString(), fantasticValue*DataManager.Instance.ScoreWeightValues[el.ToString()]);
                lifeBase.Add(el.ToString(), DataManager.Instance.LifeWeightValues[el.ToString()]);

            }
        }

        foreach(ScoreCount el2 in Enum.GetValues(typeof(ScoreCount))){
            if(el2 != ScoreCount.NONE){
                scoreCount.Add(el2.ToString(), 0);
            }
        }

        life = 50f;
        lifeGraph.Add(0, life);
        score = 0f;
        scoreInverse = 100f;
        firstEx = -1;
        firstGreat = -1;
        firstMisteak = -1;

        theLifeBar = lifeBar.GetComponent<LifeBar>();

        //var bps = thesong.getBPS(actualBPM);
        //changeBPM -= (float)(bps*thesong.offset)*speedmod;
        firstUpdate = true;
        oneSecond = 0f;
        startTheSong = (float)thesong.offset + DataManager.Instance.globalOffsetSeconds;

        //bump
        nextBump = 0;

        //combo
        ct = ComboType.FULLFANTASTIC;
        matProgressBar = progressBarEmpty.renderer.material;
        matProgressBarFull = progressBar.renderer.material;
        colorCombo = 1f;
        comboMisses = 0;
        alphaCombo = 0.5f;
        //GUI
        /*wd = posPercent.width*128;
        hg = posPercent.height*1024;
        hgt = posPercent.height*254;*/
        //ecart = 92f;

        displaying = scoreDecoupe();
        thetab = comboDecoupe();

        //Fail and clear
        fail = false;
        clear = false;
        fullCombo = false;
        fullExCombo = false;
        fullFantCombo = false;
        perfect = false;
        dead = false;
        zwip = 0;
        appearFailok = false;
        disappearFailok = false;
        zoomfail = 0f;
        failalpha = 0f;
        passalpha = 0f;
        cacheFailed = true;
        timeGiveUp = 0f;

        //Transformation display
        if(displayValue[4]){ //No judge
            limitDisplayScore = -1f;
        }

        if(displayValue[5]){ //No background
            RenderSettings.skybox = null;
            Background.GetComponent<MoveBackground>().enabled = false;
            Background.SetActiveRecursively(false);

        }

        if(displayValue[6]){ //No target
            arrowLeft.renderer.enabled = false;
            arrowDown.renderer.enabled = false;
            arrowUp.renderer.enabled = false;
            arrowRight.renderer.enabled = false;
        }

        //No score : inside the code

        //No UI
        if(displayValue[8]){
            for(int i=0;i<lifeBar.transform.childCount; i++){
                lifeBar.transform.GetChild(i).renderer.enabled = false;
            }
            progressBar.renderer.enabled = false;
            progressBarEmpty.renderer.enabled = false;
            slow.renderer.enabled = false;
            fast.renderer.enabled = false;
        }
    }
Exemplo n.º 34
0
 void Start()
 {
     LifeBar.Instance = this;
 }