예제 #1
0
    // *************************************************
    // End Player Manipulations
    // *************************************************


    // **********************************************************
    // Special effects (Floaters only)
    // **********************************************************
    static Floater AllocFloater(string text)
    {
        Floater retVal = null;

        if (m_floaterTemplate == null)
        {
            return(retVal);
        }

        if (sm_freeFloaters.Count > 0)
        {
            retVal = sm_freeFloaters[0];
            sm_freeFloaters.RemoveAt(0);
        }
        else
        {
            retVal = Instantiate(m_floaterTemplate);
            retVal.AfterInstanceInit();
        }

        retVal.SetText(text);
        retVal.gameObject.SetActive(true);

        return(retVal);
    }
예제 #2
0
    void CreateBits(CreationType ct, int density)
    {
        Transform container = new GameObject(gameObject.name + " container").transform;

        int bits = density;//qty;

        foreach (StickJoint limb in limbs)
        {
            bool terminating = limb.linked == null;

            for (int i = 0; i < bits; i++)
            {
                float point = (float)i / (float)bits;

                StickJoint linked = limb.linked;
                if (linked == null)
                {
                    linked = limb;
                }
                Floater fl = ct.MakeBit(limb, linked, point);//new Floater(limb, limb.linked ?? limb, newFloater.transform, point);
                limb.floaters.Add(fl);
                fl.floater.transform.SetParent(container);
                fl.floater.gameObject.layer = 2;

                if (terminating)
                {
                    i = bits;
                }
            }
        }
    }
예제 #3
0
        public override void ResetState()
        {
            base.ResetState();
            transform.position = defaultPosition;



            Floater f   = GetComponent <Floater>();
            Rotator r   = GetComponent <Rotator>();
            Floater f_c = GetComponentInChildren <Floater>();
            Rotator r_c = GetComponentInChildren <Rotator>();

            if (f != null)
            {
                f.Deactivate();
            }
            if (r != null)
            {
                r.Deactivate();
            }
            if (f_c != null)
            {
                f_c.Deactivate();
            }
            if (r_c != null)
            {
                r_c.Deactivate();
            }
        }
예제 #4
0
        public void FishingStart(Floater bait, Action onFail)
        {
            if (_fishingBehaviourScript != null)
            {
                return;
            }


            Debug.Log("Started Fishing!");

            OnFail = onFail;

            areaCollider.enabled = false;
            FloaterScript        = bait;
            BaitTransform        = bait.transform;

            FishingControls = new FishingControls();
            FishingControls.Rod.Reel.performed += WiggleCallback;
            FishingControls.Enable();

            ActiveFish = null;
            foreach (Fish f in Fishes)
            {
                f.FishingStart();
            }
        }
예제 #5
0
        private void showText(object sender, MouseButtonEventArgs e)
        {
            FlowDocument doc     = new FlowDocument();
            Paragraph    p       = new Paragraph();
            Image        sideImg = new Image();

            sideImg.Source =
                //new BitmapImage(new Uri("C:/Users/monstrengo/Desktop/StoryTelling1/StoryTelling1/GUI/image/" + imgNumber + ".jpg", UriKind.Relative));
                new BitmapImage(new Uri("C:/Users/parad/Desktop/StoryTelling1/StoryTelling1/GUI/image/" + imgNumber + ".jpg", UriKind.Relative));
            //new BitmapImage(new Uri(@"pack://application:,,,/image/" + imgNumber + ".jpg", UriKind.Relative));
            //new BitmapImage(new Uri("C:/Users/parad/Documents/Visual Studio 2015/Projects/StoryTelling1/StoryTelling1/GUI/image/" + imgNumber + ".jpg", UriKind.Relative));
            sideImg.Width = 300;

            BlockUIContainer blockC = new BlockUIContainer();

            blockC.Child = sideImg;
            Floater floater = new Floater(blockC);

            floater.Width = 330;
            floater.HorizontalAlignment = HorizontalAlignment.Left;
            floater.Margin = new Thickness(0, 0, 5, 5);
            p.Inlines.Add(floater);

            p.Inlines.Add(text);
            p.TextAlignment = TextAlignment.Justify;
            p.FontSize      = 22;
            p.FontFamily    = new FontFamily("Comic Sans MS");
            doc.Blocks.Add(p);
            fdViewer.Document = doc;
            doc.Blocks.Remove(blockC);

            numberShowText++;
        }
        void AddUpdatedImage(InlineCollection inlines)
        {
            var image = new Image()
            {
                Margin = new System.Windows.Thickness(0),
                Width  = 10,
                Height = 10
            };

            image.Source = ImageFactory.Instance.Load(new Uri("pack://application:,,,/Images/msg-edit.png", UriKind.Absolute));

            var container = new BlockUIContainer(image)
            {
                Margin  = new System.Windows.Thickness(0),
                Padding = new System.Windows.Thickness(0)
            };

            var floater = new Floater(container)
            {
                Width = 20,
                HorizontalAlignment = System.Windows.HorizontalAlignment.Right,
                BaselineAlignment   = System.Windows.BaselineAlignment.Top,
                Margin  = new System.Windows.Thickness(0),
                Padding = new System.Windows.Thickness(0)
            };

            inlines.Add(floater);
        }
예제 #7
0
    // *************************************************
    // End Game State Manipulations
    // *************************************************


    // *************************************************
    // Game States
    // *************************************************
    void UpdateInit()
    {
        if (HandleStateChanged())
        {
            // One frame for everyhting to settle
            return;
        }

        foreach (Player player in m_playersList)
        {
            player.gameObject.SetActive(true);
            player.Reset();
        }

        m_floaterTemplate = GetComponentInChildren <Floater>();
        m_scoreKeeper     = GetComponentInChildren <ScoreKeeper>();
        m_audioSystem     = GetComponentInChildren <AudioSystem>();

        if (m_floaterTemplate != null)
        {
            m_floaterTemplate.gameObject.SetActive(false);
        }

        ActivateLevel(m_startScreen, false);
        ActivateLevel(m_gameScreen, false);
        ActivateLevel(m_hiScoreScreen, false);

        if (m_scoreKeeper != null)
        {
            m_scoreKeeper.gameObject.SetActive(false);
        }

        ChangeState(GAME_STATE.START);
    }
예제 #8
0
    public override Unit buildUnit(int unitId, string unitName)
    {
        Unit unit = base.buildUnit(unitId, unitName);

        GoalEnvironment environment = createObject(typeof(GoalEnvironment), unit.gameObject) as GoalEnvironment;
        Floater         robot       = createObject(typeof(Floater), unit.gameObject) as Floater;
        Controller      controller  = createObject(typeof(Controller), unit.gameObject) as Controller;
        MoveBallToGoal  task        = createObject(typeof(MoveBallToGoal), unit.gameObject) as MoveBallToGoal;

        unit.constructUnit(environment, controller, robot, task);

        environment.initializeEnvironment();
        environment.setGoalAndBall(unit.origin + new Vector3(-6, .5f, 0), unit.origin + new Vector3(-2, .5f, 1));
        robot.initializeRobot();
        controller.initializeController(unitId, ModuleSeed + unitId);

        // For the initialization of task
        List <GameObject> importantMembers = new List <GameObject>();

        importantMembers.Add(environment.members[1]);
        importantMembers.Add(environment.members[2]);

        task.initializeTask(null, importantMembers, "");

        controller.isActive = true;

        return(unit);
    }
 private TextElement FindTextElement(TreeNode node, Floater f)
 {
     if (f.Tag == node)
     {
         return(f);
     }
     return(FindTextElement(node, f.Blocks));
 }
예제 #10
0
    void Start()
    {
        _animator   = GetComponent <Animator>();
        floater     = GetComponent <Floater>();
        voicePlayer = GetComponent <PlaysSoundOnRequest>();

        StartCoroutine(StartAfterCo(3f));
    }
예제 #11
0
    static public void SendFloater(Vector3 position, float duration = 2.0f, string text = null)
    {
        Floater floater = AllocFloater(text);

        if (floater != null)
        {
            floater.Go(position, duration);
        }
    }
예제 #12
0
    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent <Animator>();
        player   = GameObject.FindGameObjectWithTag("Player");
        floater  = GetComponentInParent <Floater>();

        coroutine = FireBullet(fireTime);
        StartCoroutine(coroutine);
    }
예제 #13
0
    // Use this for initialization
    void Start()
    {
        fl = Bob.GetComponent <Floater>();
        // Set the starting position for later use in the context menu reset methods
        this.bobStartingPosition    = this.Bob.transform.position;
        this.bobStartingPositionSet = true;

        this.PendulumInit();
    }
예제 #14
0
        /// <summary>
        /// Moving object by setting absolute movement.
        /// </summary>
        public void AbsoluteMoveObject()
        {
            Vector3    posMovement;
            Quaternion rotMovement;

            Floater.GetAbsoluteOffsets(out posMovement, out rotMovement);

            transform.localPosition = OriginalLocalPosition + posMovement;
            transform.localRotation = OriginalLocalRotation * rotMovement;
        }
예제 #15
0
    void OnTriggerExit(Collider collider)
    {
        Floater floater = collider.gameObject.GetComponent <Floater>();
        float   top     = transform.position.y + this.GetComponent <Collider>().bounds.extents.y;

        if (floater != null && floater.waterLevel == top)
        {
            floater.enabled = false;
        }
    }
예제 #16
0
    public override Floater MakeBit(StickJoint limb, StickJoint linked, float point)
    {
        Floater fl = new Floater(limb, linked, Instantiate(prefab).transform, point);

        Vector3 heading = fl.start.transform.position - fl.end.transform.position;

        fl.floater.transform.position = fl.start.transform.position - heading * fl.point;


        return(fl);
    }
예제 #17
0
        public override void Serialize(IPoolable poolable)
        {
            base.Serialize(poolable);
            Floater floaterPoolable   = poolable.GetGameObject.GetComponent <Floater>();
            Rotator rotatorPoolable   = poolable.GetGameObject.GetComponent <Rotator>();
            Floater cFloaterPoolable  = poolable.GetGameObject.GetComponentInChildren <Floater>();
            Rotator c_rotatorPoolable = poolable.GetGameObject.GetComponentInChildren <Rotator>();

            obj   = new FloatRotate(floaterPoolable, rotatorPoolable);
            c_obj = new FloatRotate(cFloaterPoolable, c_rotatorPoolable);
        }
예제 #18
0
 void Start()
 {
     //get all components
     fl   = floater.GetComponent <Floater>();
     fh   = floater.GetComponent <FloaterHinge>();
     flRb = floater.GetComponent <Rigidbody>();
     line = linestart.GetComponent <Line>();
     reel = GetComponent <ReelIn>();
     mc   = GetComponent <MouseControl>();
     //initialize start state
     EnableHinge();
 }
예제 #19
0
 void Awake()
 {
     ri          = GetComponent <RigidbodyInterface>();
     billboard   = GetComponentInChildren <Floater> ();
     damageInput = GetComponentInChildren <DamageInput> ();
     if (attackTransmitter == null)
     {
         attackTransmitter = GetComponentInChildren <AttackTransmitter> ();
     }
     damageInput.SetUp(this);
     attackTransmitter.SetUp(this);
 }
예제 #20
0
        /// <summary>
        /// Moving object by adding relative movement.
        /// </summary>
        public void RelativeMoveObject()
        {
            Vector3    posMovement;
            Quaternion rotMovement;

            Floater.GetRelativeOffsets(out posMovement, out rotMovement);

            //transform.Translate(posMovement);
            //transform.Rotate(rotMovement.eulerAngles);
            transform.localPosition += posMovement;
            transform.localRotation *= rotMovement;
        }
예제 #21
0
        public override IPoolable DeserializeForRuntime()
        {
            IPoolable poolable          = base.DeserializeForRuntime();
            Floater   floaterPoolable   = poolable.GetGameObject.GetComponent <Floater>();
            Rotator   rotatorPoolable   = poolable.GetGameObject.GetComponent <Rotator>();
            Floater   cFloaterPoolable  = poolable.GetGameObject.GetComponentInChildren <Floater>();
            Rotator   c_rotatorPoolable = poolable.GetGameObject.GetComponentInChildren <Rotator>();

            obj.RestoreObject(floaterPoolable, rotatorPoolable);
            c_obj.RestoreObject(cFloaterPoolable, c_rotatorPoolable);
            return(poolable);
        }
예제 #22
0
        void FloaterProps()
        {
            // <Snippet_FloaterProps>
            Floater flotx = new Floater();

            flotx.Name  = "myFloater";
            flotx.Width = 100;
            flotx.HorizontalAlignment = HorizontalAlignment.Left;

            Paragraph    parx    = new Paragraph(flotx);
            FlowDocument flowDoc = new FlowDocument(parx);
            // </Snippet_FloaterProps>
        }
예제 #23
0
        static void AddItem(TreeViewItem item, TextElement textElement)
        {
            TreeViewItem childItem;

            if (textElement is InlineUIContainer)
            {
                childItem            = new TreeViewItem();
                childItem.Header     = ((InlineUIContainer)textElement).Child.GetType().Name;
                childItem.IsExpanded = true;
                item.Items.Add(childItem);
            }
            else if (textElement is BlockUIContainer)
            {
                childItem            = new TreeViewItem();
                childItem.Header     = ((BlockUIContainer)textElement).Child.GetType().Name;
                childItem.IsExpanded = true;
                item.Items.Add(childItem);
            }
            else if (textElement is Span)
            {
                AddCollection(item, ((Span)textElement).Inlines);
            }
            else if (textElement is Paragraph)
            {
                AddCollection(item, ((Paragraph)textElement).Inlines);
            }
            else if (textElement is List)
            {
                AddCollection(item, ((List)textElement).ListItems);
            }
            else if (textElement is ListItem)
            {
                AddCollection(item, ((ListItem)textElement).Blocks);
            }
            else if (textElement is Table)
            {
                TableTreeView(item, textElement as Table);
            }
            else if (textElement is AnchoredBlock)
            {
                Floater floater = textElement as Floater;
                AddCollection(item, ((AnchoredBlock)textElement).Blocks);
            }

            //The element should be an inline (Run); try to display the text.
            else if (textElement is Inline)
            {
                TextRange range = new TextRange(((Inline)textElement).ContentEnd, ((Inline)textElement).ContentStart);
                item.Header = item.Header + " - [" + range.Text + "]";
            }
        }
예제 #24
0
        public override void Init()
        {
            Floater f = GetComponent <Floater>();
            Rotator r = GetComponent <Rotator>();

            if (f != null)
            {
                f.Activate();
            }
            if (r != null)
            {
                r.Activate();
            }
        }
        public void PhsxStep()
        {
            TR = MyLevel.MyBackground.TR;
            BL = MyLevel.MyBackground.BL;
            var c = MyLevel.MainCamera.Pos;

            TR = c + (TR - c) / Parallax;
            BL = c + (BL - c) / Parallax;

            foreach (BackgroundFloater Floater in Floaters)
            {
                Floater.PhsxStep(this);
            }
        }
예제 #26
0
    static public void FreeFloater(Floater floater)
    {
        if (floater == null)
        {
            return;
        }

        floater.gameObject.SetActive(false);

        if (!sm_freeFloaters.Contains(floater))
        {
            sm_freeFloaters.Add(floater);
        }
    }
예제 #27
0
    private void SpawnAsteroid(SpawnPoint spawnPoint)
    {
        LavaAsteroid asteroidClass = redLavaAsteroidClasses[Random.Range(0, redLavaAsteroidClasses.Length)];
        LavaAsteroid asteroid      = Instantiate(asteroidClass, spawnPoint.position, Quaternion.identity);

        asteroid.transform.localScale = asteroid.transform.localScale * Random.Range(minAsteroidSize, maxAsteroidSize);
        asteroid.manager = this;

        Floater floater = asteroid.gameObject.AddComponent <Floater>();

        floater.SetDirection(direction);
        floater.SetFloatSpeed(-16f);

        asteroids.Add(asteroid);
    }
예제 #28
0
 public void RestoreObject(Floater floaterPoolable, Rotator rotatorPoolable)
 {
     if (floaterPoolable != null)
     {
         floaterPoolable.halfAmplitude      = floatDerivation;
         floaterPoolable.period             = floatPeriod;
         floaterPoolable.randomInitPosition = floatRandomize;
     }
     if (rotatorPoolable != null)
     {
         rotatorPoolable.axis      = rotatorAxis;
         rotatorPoolable.period    = rotatorPeriod;
         rotatorPoolable.direction = rotatorDirection;
         rotatorPoolable.randomize = rotatorRandomize;
     }
 }
예제 #29
0
    void Awake()
    {
        _floater = GetComponentInChildren <Floater>();

        _movement = GetComponent <RobberMovement>();
        _movement.Initilise(_data.InitialMoveSpeed);
        _movement.OnBankReached += Steal;
        _movement.OnExitReached += Escape;

        _health = GetComponent <Health>();
        _health.Initilise(_data.InitialHP);
        _health.OnDeath += Die;

        _stealer = GetComponent <Stealer>();
        _stealer.Initilise(_data.InitialStealAmount);

        _difficultyWeight = new ModifiableStat(_data.InitialDifficultyWeight);
    }
예제 #30
0
    void OnTriggerEnter(Collider collider)
    {
        Rigidbody rigidbody = collider.gameObject.GetComponent <Rigidbody>();
        Floater   floater   = collider.gameObject.GetComponent <Floater>();

        if (rigidbody != null)
        {
            if (floater != null)
            {
                float top = transform.position.y + this.GetComponent <Collider>().bounds.extents.y;

                if (top > floater.waterLevel || !floater.enabled)
                {
                    floater.waterLevel = top;
                }
                floater.enabled = true;
            }
        }
    }