Exemplo n.º 1
0
        private void Update()
        {
            Assert.IsTrue(interval >= intervalMinimum);
            Assert.IsNotNull(prefab);

            time += Time.deltaTime;

            while (time >= interval)
            {
                time -= interval;
                Pooling.GetObject(prefab, transform.position, transform.rotation);
            }
        }
Exemplo n.º 2
0
    private void OnClick()
    {
        if (interactable.value != null && interactable.value is Unit)
        {
            UnitAction unit = Pooling.GetObject(unitAction);

            Unit oldUnit = interactable.value as Unit;
            unit.transform.position = oldUnit.transform.position;
            oldUnit.DisableUnit();

            interactable.value = unit.GetComponent <Unit>();
            interactable.value.ToggleSelectionEffect();
        }
    }
Exemplo n.º 3
0
    private void CreateNode(GraphNode node)
    {
        Vector3 nodePos = (Vector3)node.position;

        Quaternion finalRot = Quaternion.identity;

        if (thisObject.isStartNode || thisObject.isEndNode)
        {
            finalRot = Quaternion.identity;
        }
        else
        {
            finalRot = Quaternion.Euler(new Vector3(0, 45, 0));
        }

        //GameObject _nodeObject = ObjectPooling.SpawnFromPool("Node", nodePos, finalRot, thisObject.transform);
        GameObject _nodeObject = Pooling.GetObject(thisObject.nodePrefab);

        _nodeObject.name = "Node " + WaypointCreator.nodePositions.Count;
        _nodeObject.transform.position = nodePos;
        _nodeObject.transform.rotation = finalRot;

        NodeData newNode = new NodeData
        {
            isStart      = thisObject.isStartNode,
            isEnd        = thisObject.isEndNode,
            nodePosition = node.position,
            nodeObject   = _nodeObject.GetComponent <Waypoint>()
        };

        WaypointCreator.nodePositions.Add(newNode);

        if (thisObject.isStartNode)
        {
            _nodeObject.name = "Start Node";
            thisObject.worldContainsStartNode = true;
        }
        else if (thisObject.isEndNode)
        {
            _nodeObject.name = "End Node";
            thisObject.worldContainsEndNode = true;
        }

        thisObject.isStartNode = false;
        thisObject.isEndNode   = false;

        //Debug.DrawLine(cam.transform.position, (Vector3)newNode.nodePosition, Color.yellow, 2);
    }
Exemplo n.º 4
0
    private void Update()
    {
        if (target == null)
        {
            return;
        }

        if (target.gameObject.activeSelf == false)
        {
            target = null;
        }

        if (timer.IsTimerUp())
        {
            Projectile currentProjectile = Pooling.GetObject(projectile);

            currentProjectile.transform.position = shootingPoint.position;
            currentProjectile.gameObject.layer   = gameObject.layer;
            currentProjectile.Fire(target.transform, stats.actionAmount);
        }
    }