예제 #1
0
 // Start is called before the first frame update
 void Start()
 {
     holderCanMove = false;
     if (newHolderPosNode != null)
     {
         newHolderPos = DataContainer.GetVector2(newHolderPosNode);
     }
 }
예제 #2
0
 public override void Start(Data data)
 {
     if (data.Has(dataNode))
     {
         dataNode = data.GetVector2(dataNode.Name);
     }
     else
     {
         data.Add(dataNode);
     }
 }
예제 #3
0
    public DataVector2 Vector2(DataVector2 node)
    {
        DataVector2 found = vector2s.Find(d => d.Name == node.Name);

        if (found != null)
        {
            return(found);
        }
        else
        {
            vector2s.Add(node);
        }
        return(node);
    }
예제 #4
0
    private void DrawVector2Element(Rect rect, int index, bool active, bool focused)
    {
        DataVector2 node = data.Vector2s[index];

        EditorGUI.BeginChangeCheck();

        node.Name = EditorGUI.TextField(new Rect(rect.x, rect.y, rect.width / 3, rect.height - 1), node.Name);

        node.Value = EditorGUI.Vector2Field(new Rect(rect.x + rect.width / 2, rect.y, rect.width / 2, rect.height - 1), GUIContent.none, node.Value);


        if (EditorGUI.EndChangeCheck())
        {
            EditorUtility.SetDirty(target);
        }
    }
    IEnumerator Start()
    {
        dataNode       = data.Vector2(dataNode);
        reactionRadius = data.Float(reactionRadius);

        while (true)
        {
            if (target != null)
            {
                reactionRadius.Value = 5;
                float d = Vector2.Distance(transform.position, target.transform.position);

                if (d < reactionRadius.Value)
                {
                    dataNode.Value = (target.transform.position - transform.position).normalized;
                }
                if (d > reactionRadius.Value)
                {
                    // int direction = 1 + (int)(2.99f * Mathf.PerlinNoise(counter.Value++ * 0.2f, 0.5f));
                    int direction = Random.Range(1, 4);
                    switch (direction)
                    {
                    case 1:
                        dataNode.Value = (targetIdleA.transform.position - transform.position).normalized;
                        break;

                    case 2:
                        dataNode.Value = (targetIdleB.transform.position - transform.position).normalized;
                        break;

                    case 3:
                        dataNode.Value = (targetIdleC.transform.position - transform.position).normalized;
                        break;
                    }
                }
            }
            yield return(new WaitForSeconds(0.8f));
        }
    }
예제 #6
0
 public void Add(DataVector2 data)
 {
     vector2s.Add(data);
 }
예제 #7
0
 public bool Has(DataVector2 data)
 {
     return(vector2s.Find(d => d.Name == data.Name) != null);
 }
예제 #8
0
 // Start is called before the first frame update
 void Start()
 {
     dataSpeed        = data.Float(dataSpeed);
     dataAcceleration = data.Float(dataAcceleration);
     dataInput        = data.Vector2(dataInput);
 }
 // Start is called before the first frame update
 void Start()
 {
     dataNode = data.Vector2(dataNode);
 }
예제 #10
0
 public override void Start(Data data)
 {
     dataNode = data.Vector2(dataNode);
 }
예제 #11
0
 public static DataVector2 Vector2(DataVector2 node)
 {
     return(instance.data.Vector2(node));
 }