Exemple #1
0
        /// <summary>
        /// Do not use this directly.
        /// Size is fixed to 150f, 150f.
        /// </summary>
        /// <param name="pos">Position</param>
        /// <param name="type">Creature Type</param>
        public UIcreature(Vector2 pos, CreatureTemplate.Type type) : base(pos, new Vector2(150f, 150f))
        {
            _inBox = true;
            if (!init)
            {
                return;
            }

            this.rect = new DyeableRect(menu, owner, pos + offset, size, true);
            this.subObjects.Add(this.rect);
            //owner.subObjects.Add(this.menuObj);

            this._type = type;

            cage = new FContainer();
            this.myContainer.AddChild(cage);
            cage.SetPosition(new Vector2(75f, 20f));
            fence = new FContainer();
            this.myContainer.AddChild(fence);
            fence.SetPosition(new Vector2(75f, 20f));
            fence.MoveToFront();

            absTemplate       = new OptionalCreatureTemplate(type);
            absCreature       = new OptionalAbstractCreature(world, absTemplate);
            absCreature.state = new OptionalCreatureState(absCreature);
        }
Exemple #2
0
    override public void Update()
    {
        graveHolder.SetPosition(x, y);

        if (!isCloudDone)
        {
            cloudHolder.SetPosition(x, y);

            if (totalFrame % 10 == 0)
            {
                frame++;
                if (frame < frames.Length)
                {
                    cloudSprite.element = frames[frame];
                }
                else
                {
                    cloudHolder.RemoveFromContainer();
                    isCloudDone = true;
                }
            }

            cloudSprite.y += 0.5f;

            totalFrame++;
        }
    }
Exemple #3
0
    override public void Update()
    {
        hopper.Update();

        attackCooldown -= Time.deltaTime;

        if (attackCooldown < 0)
        {
            attackCooldown = RXRandom.Range(0.9f, 1.0f) * Config.VILLAGER_ATTACK_COOLDOWN;

            if (Arena.instance != null && Arena.instance.dayManager.isDay)
            {
                CheckForAttack();
            }
        }

        float scaleXMultiplier = body.scaleX < 0 ? -1f : 1f;
        float scaleMultiplier  = 1.0f;

        if (hopper.jumpTime > 0)
        {
            scaleXMultiplier = (hopper.speedX < 0) ? -1.0f : 1.0f;
            scaleMultiplier  = 0.75f + 0.3f * hopper.jumpY;
        }

        body.scaleX = scaleXMultiplier / scaleMultiplier;
        body.scaleY = scaleMultiplier;

        bodySprite.y  = offsetY + hopper.jumpY * hopper.config.jumpHeight;
        colorSprite.y = bodySprite.y;
        weapon.x      = bodySprite.x + 4;
        weapon.y      = bodySprite.y + 4;

        pushSpeed *= 0.93f;

        if (pushSpeed.sqrMagnitude > 0.05f)
        {
            float newX = x + pushSpeed.x;
            float newY = y + pushSpeed.y * Config.ISO_RATIO;

            if (!entityArea.CheckVillPointHit(newX, newY))
            {
                x = newX;
                y = newY;
            }
            else if (!entityArea.CheckVillPointHit(x, newY))
            {
                pushSpeed.x = -pushSpeed.x * 0.5f;
                y           = newY;
            }
            else if (!entityArea.CheckVillPointHit(newX, y))
            {
                x           = newX;
                pushSpeed.y = -pushSpeed.y * 0.5f;
            }
        }

        body.SetPosition(x, y);
        shadowSprite.SetPosition(x, y);
    }
Exemple #4
0
 void ApplyConfig()
 {
     barContainer.SetPosition(barOffset);
     background.SetPosition(1, 1.5f);
     background.height = dashHeight + 1.0f;
     background.width  = totalWidth - 1;
 }
Exemple #5
0
 override public void Update()
 {
     main.SetPosition(x, y);
     if (!hasDoneAttack)
     {
         hasDoneAttack = true;
         sprite.scale  = 0.4f;
         Go.to(sprite, 0.2f, new TweenConfig().x(-7.0f).scaleXY(0.5f).alpha(0.0f).onComplete(OnTweenComplete));
         float size = 24;
         Arena.instance.HitHumansInRect(this.vill, new TORect(x - size / 2, y - size / 2, size, size), angle);
     }
 }
Exemple #6
0
        public BossInterface(EntityCreature owner) : base()
        {
            _owner = owner;

            _bar        = new FSprite("uipixel");
            _bar.scaleY = 8f;

            _barCase = new FSprite("bosshealth");

            _barContainer = new FContainer();
            _barContainer.SetPosition(0f, MenuFlow.screenHeight * 0.5f - 16f);

            _barContainer.AddChild(_bar);
            _barContainer.AddChild(_barCase);

            container.AddChild(_barContainer);
        }
Exemple #7
0
        public WorldCameraUI(WorldCamera worldCamera)
        {
            _worldCamera = worldCamera;

            _axisContainer = new FContainer();
            _axisContainer.SetPosition(Futile.screen.halfWidth - 36f, Futile.screen.halfHeight - 20f);
            _axisContainer.scaleY = 0.5f;
            Futile.stage.AddChild(_axisContainer);

            _axisSprites = new FSprite[4];
            for (int index = 0; index < _axisSprites.Length; index++)
            {
                _axisSprites[index]         = new FSprite("Futile_White");
                _axisSprites[index].color   = index == 3 ? Color.red : Color.black;
                _axisSprites[index].anchorY = 0f;
                _axisSprites[index].scaleY  = 0f;
                _axisSprites[index].scaleX  = 0.15f;
                _axisContainer.AddChild(_axisSprites[index]);
            }

            _axisShowFactor = 0f;
        }
Exemple #8
0
 override public void Update()
 {
     main.SetPosition(x, y + offsetY);
 }
Exemple #9
0
        public override void Update(float dt)
        {
            base.Update(dt);


            if (keyboardOn)
            {
                cursor.alpha = Mathf.Clamp(cursorAlpha, 0f, 1f);
                cursor.SetPosition(new Vector2(this.value.Length * 7f + 6f, this.size.y * 0.5f - 7f));
                cursorAlpha -= 0.05f;
                if (cursorAlpha < -0.5f)
                {
                    cursorAlpha = 2f;
                }

                //input spotted! ->cursorAlpha = 2.5f;
                foreach (char c in Input.inputString)
                {
                    //Debug.Log(string.Concat("input: ", c));
                    if (c == '\b')
                    {
                        cursorAlpha = 2.5f; flash = 2.5f;
                        if (this.value.Length > 0)
                        {
                            this.ForceValue(this.value.Substring(0, this.value.Length - 1));
                            if (!_soundFilled)
                            {
                                _soundFill += 12;
                                menu.PlaySound(SoundID.MENY_Already_Selected_MultipleChoice_Clicked);
                            }
                            OnChange();
                        }
                        break;
                    }
                    else if ((c == '\n') || (c == '\r')) // enter/return
                    {
                        keyboardOn            = false;
                        this.cursor.isVisible = false;
                        if (this.accept == Accept.Float)
                        {
                            if (!float.TryParse(this.value, out _))
                            {
                                for (int i = this.value.Length - 1; i > 0; i--)
                                {
                                    if (float.TryParse(this.value.Substring(0, i), out _))
                                    {
                                        this.ForceValue(this.value.Substring(0, i));
                                        OnChange();
                                        menu.PlaySound(SoundID.Mouse_Light_Switch_On);
                                        return;
                                    }
                                }
                            }
                        }
                        menu.PlaySound(SoundID.MENU_Checkbox_Check);
                        break;
                    }
                    else
                    {
                        cursorAlpha = 2.5f;
                        flash       = 2.5f;
                        this.value += c;
                    }
                }
            }
            else
            {
                cursorAlpha = 0f;
            }
            if (Input.GetMouseButton(0) && !mouseDown)
            {
                mouseDown = true;
                if (MouseOver && !keyboardOn)
                { //Turn on
                    menu.PlaySound(SoundID.MENU_Button_Select_Gamepad_Or_Keyboard);
                    keyboardOn            = true;
                    this.cursor.isVisible = true;
                    this.cursorAlpha      = 1f;
                    cursor.SetPosition(new Vector2(this.value.Length * 7f + 6f, this.size.y * 0.5f - 7f));
                }
                else if (!MouseOver && keyboardOn)
                { //Shutdown
                    keyboardOn            = false;
                    this.cursor.isVisible = false;
                    if (this.accept == Accept.Float)
                    {
                        if (!float.TryParse(this.value, out _))
                        {
                            for (int i = this.value.Length - 1; i > 0; i--)
                            {
                                if (float.TryParse(this.value.Substring(0, i), out _))
                                {
                                    this.ForceValue(this.value.Substring(0, i));
                                    OnChange();
                                    menu.PlaySound(SoundID.Mouse_Light_Switch_On);
                                    return;
                                }
                            }
                        }
                    }
                    menu.PlaySound(SoundID.MENU_Checkbox_Uncheck);
                }
            }
            else if (!Input.GetMouseButton(0))
            {
                mouseDown = false;
            }
        }