Ejemplo n.º 1
0
    void ProcessLandoltMessage(Osc.Message msg)
    {
        try {
            var json = JSON.Parse(msg.data[0].ToString());
            var data = convertToLandoltData(json);

            int landoltIndex = "/landolt".Length;
            if (msg.path.IndexOf("/create") == landoltIndex)
            {
                LandoltManager.Create(data);
            }
            else if (msg.path.IndexOf("/update") == landoltIndex)
            {
                LandoltManager.Update(data);
            }
            else if (msg.path.IndexOf("/remove") == landoltIndex)
            {
                LandoltManager.Remove(data);
            }
            else
            {
                Debug.LogWarning("unknown message: " + msg);
            }
        } catch (Exception e) {
            Debug.LogWarning(e.Message);
            Debug.LogWarning(msg);
        }
    }
Ejemplo n.º 2
0
    IEnumerator Dead()
    {
        if (deadWaitTime < 1f)
        {
            deadWaitTime += 1f;
        }
        yield return(new WaitForSeconds(deadWaitTime - 1f));

        var landolt = LandoltManager.GetFirst();

        if (landolt)
        {
            landolt.EmitRevivalSphere(gameObject);
        }

        yield return(new WaitForSeconds(1f));

        BroadcastMessage("OnRevival");
    }
Ejemplo n.º 3
0
 void Update()
 {
     if (frameCount_ > 30)
     {
         var target    = LandoltManager.GetFirst();
         var targetPos = GlobalObjects.localStage.transform.position + Vector3.back * 1.5f;
         if (target)
         {
             targetPos = target.transform.position;
         }
         var dir = (targetPos - transform.position).normalized;
         velocity += (dir * targetSpeed - velocity) * damping;
     }
     if (frameCount_ > 120)
     {
         Destroy(gameObject);
     }
     transform.position += velocity * Time.deltaTime;
     ++frameCount_;
 }
Ejemplo n.º 4
0
    void Update()
    {
        ++lostCount_;
        if (lostCount_ > 180)
        {
            LandoltManager.Remove(data_);
        }

        if (isInitialized_)
        {
            transform.localPosition = (rawPos_ - transform.localPosition) * filter;
            var from = transform.localRotation;
            var to   = Quaternion.Euler(0f, Mathf.Rad2Deg * currentAngle_ + 90, 0f);
            transform.localRotation = Quaternion.Slerp(from, to, filter);
        }
        else
        {
            transform.localPosition = rawPos_;
            transform.localRotation = Quaternion.Euler(0f, Mathf.Rad2Deg * currentAngle_ + 90, 0f);
        }
    }
Ejemplo n.º 5
0
 void Awake()
 {
     Instance = this;
 }
Ejemplo n.º 6
0
 void Start()
 {
     landolt_ = GetComponent <Landolt>();
     landolt_._SetRawPos(transform.localPosition);
     LandoltManager.AddDummy(-1, landolt_);
 }