Inheritance: MonoBehaviour
コード例 #1
0
ファイル: UIEngine.cs プロジェクト: Peng-Zhiyuan/mylib
    public static Floating GetControl(string name)
    {
        Floating control = null;

        createdControl.TryGetValue(name, out control);
        return(control);
    }
コード例 #2
0
        protected override void OnAttached()
        {
            if (!(Element is Page))
            {
                return;
            }

            OnceInitializeAction = Initialize;

            _formsLayout        = Floating.GetContent(Element);
            _formsLayout.Parent = Element;

            _page                = Element as Page;
            _page.SizeChanged   += PageSizeChanged;
            _page.LayoutChanged += PageLayoutChanged;

            void BindingContextChanged(object sender, EventArgs e)
            {
                // When the target is a Page, since OnDetached method isn't automatically called,
                // manually make it call at this timing.
                if (_page.BindingContext != null && !IsAttached)
                {
                    return;
                }

                _page.BindingContextChanged -= BindingContextChanged;

                var toRemove = Element.Effects.OfType <AiRoutingEffectBase>().FirstOrDefault(x => x.EffectId == ResolveId);

                Element.Effects.Remove(toRemove);
            }

            _page.BindingContextChanged += BindingContextChanged;
        }
コード例 #3
0
    // Start is called before the first frame update
    void Start()
    {
        phase3Backend  = new GameObject();
        phase3Frontend = new GameObject();

        explosionDeathInstance = Instantiate(
            explosionDeath,
            Vector3.zero,
            explosionDeath.transform.rotation
            );

        InitVulnerableParts();

        flyToLinear       = GetComponent <FlyToLinear>();
        bossBodyTransform = transform.Find("Boss Body");
        spinning          = GetComponent <RotateAroundLinear>();
        spinAround        = GetComponent <Spinning>();
        enemyShooting     = GetComponent <EnemyShooting>();
        floating          = bossBodyTransform.GetComponent <Floating>();

        rocket1Spawn = lowerRocketParts.transform.Find("Lower Rocket Jet").gameObject;
        rocket2Spawn = upperRocketParts.transform.Find("Upper Rocket Jet").gameObject;
        hangarSpawn  = hangarParts.transform.Find("Hangar Opening").gameObject;

        rocket1 = lowerRocketParts.transform.Find("Lower Rocket Open").GetComponent <RotateAroundLinear>();
        rocket2 = upperRocketParts.transform.Find("Upper Rocket Open").GetComponent <RotateAroundLinear>();
        hangar  = hangarParts.transform.Find("Hangar Door").GetComponent <RotateAroundLinear>();

        roundDone = true;

        initMoveSpeed     = moveSpeed;
        initRotationSpeed = spinning.speed;
    }
コード例 #4
0
 void Start()
 {
     explosionSound = GameObject.FindGameObjectWithTag("ExplosionSound").GetComponent <AudioSource>();
     floating       = GetComponent <Floating>();
     boxCol         = GetComponent <BoxCollider2D>();
     rb             = GetComponent <Rigidbody2D>();
 }
コード例 #5
0
        /// <summary>
        /// Formats the shape.
        /// </summary>
        /// <param name="area">The area to fit in the shape.</param>
        /// <param name="previousFormatInfo"></param>
        internal override void Format(Area area, FormatInfo previousFormatInfo)
        {
            Floating floating = GetFloating();
            bool     fits     = floating == Floating.None || this.ShapeHeight <= area.Height;

            ((ShapeFormatInfo)this.renderInfo.FormatInfo).fits = fits;
            FinishLayoutInfo(area);
        }
コード例 #6
0
        /// <summary>
        /// Formats the shape.
        /// </summary>
        /// <param name="area">The area to fit in the shape.</param>
        /// <param name="previousFormatInfo"></param>
        public override void Format(Area area, FormatInfo previousFormatInfo)
        {
            Floating floating = GetFloating();
            bool     fits     = floating == Floating.None || ShapeHeight <= area.Height;

            ((ShapeFormatInfo)_renderInfo.FormatInfo).Fits = fits;
            FinishLayoutInfo(area);
        }
コード例 #7
0
ファイル: houseboatOnLand.cs プロジェクト: Bruno13/TheForest
 private void Awake()
 {
     this._bu               = base.transform.GetComponent <Buoyancy>();
     this._fl               = base.transform.GetComponent <Floating>();
     this._rb               = base.transform.GetComponent <Rigidbody>();
     this._startDrag        = this._rb.drag;
     this._startAngularDrag = this._rb.angularDrag;
 }
コード例 #8
0
 private void Awake()
 {
     this._bu = base.transform.GetComponent<Buoyancy>();
     this._fl = base.transform.GetComponent<Floating>();
     this._rb = base.transform.GetComponent<Rigidbody>();
     this._startDrag = this._rb.drag;
     this._startAngularDrag = this._rb.angularDrag;
 }
コード例 #9
0
ファイル: UIEngine.cs プロジェクト: Peng-Zhiyuan/mylib
    public static void HideFlaoting(string name)
    {
        Debug.Log("Hide Control: " + name);
        Floating control = null;

        createdControl.TryGetValue(name, out control);
        if (control != null)
        {
            control.Active = false;
        }
    }
コード例 #10
0
    void Start()
    {
        this.transform.position = new Vector3();
        for (int i = 0; i < m_NumberOfSpheres; i++)
        {
            var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            var size   = Random.Range(1f, 2.5f);
            sphere.transform.localScale    = new Vector3(size, size, size);
            sphere.transform.parent        = this.transform;
            sphere.renderer.material.color = Color.red;
            var location = new Vector3();
            var kill     = false;
            for (int j = 0; j < 5000; j++)
            {
                location = CalculatePoint(new Vector3());
                if (!TouchingAnotherCircle(location, size / 10f))
                {
                    break;
                }
                if (j > 4800)
                {
                    kill = true;
                }
            }
            sphere.transform.localPosition = location;


            if (kill)
            {
                Destroy(sphere);
            }
            else
            {
                m_List.Add(sphere);
            }
        }
        this.transform.position = new Vector3(76, -13, 0);

        foreach (var sphere in m_List)
        {
            Floating.AttachToGameObject(sphere, new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), 0));

            //Vector3 Strength = new Vector3(0.5f, 0.5f, 0.5f);
            //float Freq = 0.25f;
            //sphere.AddComponent(typeof(MegaNoise));
            //var noise = (MegaNoise)sphere.GetComponent(typeof(MegaNoise));
            //noise.Strength = Strength;
            //noise.Animate = true;
            //noise.Freq = Freq;
            //noise.Phase = Random.Range(0f, 100f);
        }
        //Debug.Log("tesssssss " + this.transform.localPosition + "    fdswgvergerg " + this.transform.position);
    }
コード例 #11
0
ファイル: Program.cs プロジェクト: Nookee411/OOP-Lab2
        static void Main(string[] args)
        {
            double   a = 1.25;
            Floating b = new Floating(a);

            Console.WriteLine(b);
            double c = b.ToDouble();

            Console.WriteLine(b.ExponentBinary);
            Console.WriteLine(b.ExponentInt());
            Console.WriteLine(c);
        }
コード例 #12
0
        /// <summary>
        /// Determines if the given value represents a valid state of this property.
        /// </summary>
        /// <param name="value">The state that should be used.</param>
        /// <returns>True if the state is valid, otherwise false.</returns>
        protected override Boolean IsValid(CSSValue value)
        {
            Floating mode;

            if (modes.TryGetValue(value, out mode))
            {
                _mode = mode;
                return(true);
            }

            return(false);
        }
コード例 #13
0
ファイル: UIManager.cs プロジェクト: Pippocimut/Tecnologie2
    IEnumerator Waitforconnection()
    {
        while (!Client.instance.isConnected)
        {
            yield return(new WaitForSeconds(0.03f));
        }
        Cursor.visible = false;
        Floating _one = uno.GetComponent <Floating>();
        Floating _two = due.GetComponent <Floating>();

        _one.degreesPerSecond = _two.degreesPerSecond = 1500;
        _one.amplitude        = _two.amplitude = 0.2f;
        Animazioni();
    }
コード例 #14
0
        protected override void OnAttached()
        {
            if (!(Element is XF.Page))
            {
                return;
            }

            var layout = Floating.GetContent(Element);

            layout.Parent = Element;

            // All following process is done on the side of FloatingLayoutRenderer.
            Platform.CreateRendererWithContext(layout, Container.Context);
        }
コード例 #15
0
    void Start()
    {
        currentHP       = hp;
        currentFloating = transform.root.GetComponent <Floating>();
        SetColorCup();
        if (projectileType == ThrowerType.Beer)
        {
            sp = GameObject.Find("BeerPool").GetComponent <SimplePooling>();
        }
        else if (projectileType == ThrowerType.Flipflop)
        {
            sp = GameObject.Find("FlipflopPool").GetComponent <SimplePooling>();
        }
        if (projectileType == ThrowerType.Mic)
        {
            sp = GameObject.Find("MicPool").GetComponent <SimplePooling>();
        }
        if (projectileType == ThrowerType.Plate)
        {
            sp = GameObject.Find("PlatePool").GetComponent <SimplePooling>();
        }
        if (projectileType == ThrowerType.Redcup)
        {
            sp = GameObject.Find("RedcupPool").GetComponent <SimplePooling>();
        }
        if (projectileType == ThrowerType.Speaker)
        {
            sp = GameObject.Find("SpeakerPool").GetComponent <SimplePooling>();
        }
        if (projectileType == ThrowerType.Money)
        {
            sp = GameObject.Find("MoneyPool").GetComponent <SimplePooling>();
        }
        if (projectileType == ThrowerType.Coffin)
        {
            sp = GameObject.Find("CoffinPool").GetComponent <SimplePooling>();
        }



        rb = gameObject.GetComponent <Rigidbody>();
        if (danceID != -1)
        {
            anim.SetInteger("DanceID", danceID);
        }
        else
        {
            anim.SetInteger("DanceID", Random.Range(0, 3));
        }
    }
コード例 #16
0
ファイル: Program.cs プロジェクト: mertturkmenoglu/csharp
        public static void Main(string[] args)
        {
            Vehicle sv = new SpecialVehicle();
            Vehicle pv = new PublicVehicle();

            sv.PrintMessage();
            pv.PrintMessage();
            sv.PrintPlate();
            pv.PrintPlate();

            INumber  intNumber = new Integer(42);
            Floating floating  = new Floating(3.14f);

            intNumber.PrintValue();
            floating.PrintValue();
        }
コード例 #17
0
    public void OnMouseDown()
    {
        if (editorModeOn && player.GetComponent <EditorGUI>().toggleDrag)
        {
            // If the object being dragged is  floating (like the health drop)
            // The Floating script is temporarily removed
            if (!missingFloating && gameObject.GetComponent <Floating>())
            {
                floatingScript = gameObject.GetComponent <Floating>();
                Destroy(floatingScript);
                missingFloating = true;
            }

            // Pulls object to the cursor
            deltaX = Camera.main.ScreenToWorldPoint(Input.mousePosition).x - transform.position.x;
            deltaY = Camera.main.ScreenToWorldPoint(Input.mousePosition).y - transform.position.y;
        }
    }
コード例 #18
0
ファイル: UIEngine.cs プロジェクト: Peng-Zhiyuan/mylib
    public static void RepositionMask()
    {
        Page firstPage = PageStack.Peek();

        if (firstPage.Overlay)
        {
            Floating control = ShowFlaoting("MaskControl", null, firstPage.Depth - 1);
            control.transform.SetAsLastSibling();
            control.transform.SetSiblingIndex(firstPage.transform.GetSiblingIndex());
        }
        else
        {
            Floating c = GetControl("MaskControl");
            if (c != null)
            {
                c.Active = false;
            }
        }
    }
コード例 #19
0
ファイル: UIEngine.cs プロジェクト: Peng-Zhiyuan/mylib
    /// <summary>
    /// 控件,是指整个游戏中只有一个实例的视图
    /// 控件由 UIEngine 直接管理,parent 坐标固定为(0,0)
    /// 因此控件的位置,缩放等可以提前设计
    /// </summary>
    /// <param name="name"></param>
    /// <returns></returns>
    public static Floating ShowFlaoting(string name, string param = null, int depth = UIDepth.High)
    {
        Debug.Log("Show Control: " + name);

        Floating control = null;

        createdControl.TryGetValue(name, out control);
        if (control == null)
        {
            var prefab = LoadControlPrefab(name);

            if (prefab == null)
            {
                Debug.LogError("control prefab:" + name + " not found");
                return(null);
            }

            var root = GetRootFromDepth(depth);
            var go   = GameObject.Instantiate(prefab);
            control                         = go.GetComponent <Floating>();
            control.name                    = prefab.name;
            control.transform.parent        = root.transform;
            control.transform.localScale    = Vector2.one;
            control.rectTransform.anchorMin = Vector2.zero;
            control.rectTransform.anchorMax = Vector2.one;
            control.rectTransform.offsetMin = Vector2.zero;
            control.rectTransform.offsetMax = Vector2.zero;

            control.OnCreate();
            createdControl[name] = control;
        }
        control.param = param;
        control.OnParamChanged();
        control.Active = true;
        control.Depth  = depth;
        return(control);
    }
コード例 #20
0
 internal override void Reset()
 {
     _mode = Default;
 }
コード例 #21
0
 public void SetState(Floating mode)
 {
     _mode = mode;
 }
コード例 #22
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.name == "ReviveZone")
        {
            if (anim.GetBool("Rescue") == false)
            {
                return;
            }
            anim.ResetTrigger("Attack");
            anim.ResetTrigger("Impact");
            anim.ResetTrigger("Hurt");
            anim.ResetTrigger("HeavyHurt");
            anim.SetBool("Move", false);
            GetComponent <AudioSource>().PlayOneShot(savedSFX);
            //hack Must Delay
            transform.parent = other.transform.root;
            isEnemy          = false;
            currentHP        = hp / 2;
            isDeath          = false;
            currentFloating  = transform.root.GetComponent <Floating>();

            if (currentFloating.npcs.Contains(this) == false)
            {
                currentFloating.npcs.Add(this);
            }
            GameObject.Find("Player").GetComponent <CharacterMovement>().SetNPCRevive();

            SetColorCup();
            ///hack careful for multiplayer
            if (danceID != -1)
            {
                anim.SetInteger("DanceID", danceID);
            }
            else
            {
                anim.SetInteger("DanceID", Random.Range(0, 3));
            }
            gameObject.layer = LayerMask.NameToLayer("NPC");
            anim.SetBool("OnWater", false);
            anim.SetBool("Death", false);
            rb.velocity    = Vector3.zero;
            rb.isKinematic = false;
            anim.SetBool("Rescue", false);
            CheckDuty();
        }
        else if (other.name == "Saver")
        {
            if (other.transform.root.GetComponent <CharacterMovement>().npcOnHand == null)
            {
                GetComponent <AudioSource>().PlayOneShot(savingSFX);
                anim.SetBool("Rescue", true);
                Debug.Log("Got Save");
                other.transform.root.gameObject.GetComponent <CharacterMovement>().SetNpcOnHand(this);
                transform.parent = other.transform.root;
                GetComponent <Rigidbody>().isKinematic = true;
                transform.localPosition = Vector3.zero;
            }
        }
        else if (other.name == "HitBox")
        {
            if (currentFloating.isPlayerFloating && other.transform.root.name == "Player")
            {
                return;
            }
            if (other.transform.root.name != transform.root.name)
            {
                GetComponent <AudioSource>().clip = hurtSFX[Random.Range(0, hurtSFX.Length)];
                GetComponent <AudioSource>().Play();
                if (other.GetComponent <HeavyObject>() != null)
                {
                    anim.SetTrigger("HeavyHurt");
                    currentHP -= 5;
                    if (currentFloating.lenNumber == Floating.floatingPosition.Top)
                    {
                        rb.AddForce(0, 25, 50);
                    }
                    else if (currentFloating.lenNumber == Floating.floatingPosition.Bottom)
                    {
                        rb.AddForce(0, 25, -50);
                    }
                }
                else
                {
                    currentHP -= 3;
                    anim.SetTrigger("Hurt");
                }
            }
        }
        else if (other.GetComponent <ThrowingObject>() != null)
        {
            if (currentFloating.name != other.tag)
            {
                GetComponent <AudioSource>().clip = hurtSFX[Random.Range(0, hurtSFX.Length)];
                GetComponent <AudioSource>().Play();
                if (other.GetComponent <ThrowingObject>().damge > 1)
                {
                    anim.SetTrigger("HeavyHurt");
                    if (currentFloating.lenNumber == Floating.floatingPosition.Top)
                    {
                        rb.AddForce(0, 25, 50);
                    }
                    else if (currentFloating.lenNumber == Floating.floatingPosition.Bottom)
                    {
                        rb.AddForce(0, 25, -50);
                    }
                }
                else
                {
                    anim.SetTrigger("Hurt");
                }
                currentHP -= other.GetComponent <ThrowingObject>().damge;
                other.gameObject.SetActive(false);
            }
        }
        else
        {
        }
        if (currentHP <= 0 && isDeath == false)
        {
            Bounce();
        }
    }
コード例 #23
0
 void EndEase(Vector3 offset)
 {
     CurrentPosition = SwapPosition(CurrentPosition);
     Floating.AttachToGameObject(gameObject, offset, CurrentPosition == TogglePosition.Open ? c_FloatMin : c_FloatMax);
 }
コード例 #24
0
 internal override void Reset()
 {
     _mode = Floating.None;
 }