Exemplo n.º 1
0
 public Slowdown(GameObject from, GameObject target, float dur) :
     base(from, target, dur)
 {
     controller = this.target.transform.parent.GetComponent <ControllerSystem>();
     icon       = LoadStatusSprite("status_slowdown");
     name       = "Slowdown";
 }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        targetVec = Vector3.zero;
        targetObj = null;

        // Camera
        float camHorizontal = ControllerSystem.GetAxis(ControllerSystem.Axis.Stick_R_X);
        float camVertical   = ControllerSystem.GetAxis(ControllerSystem.Axis.Stick_R_Y);

        camTargetVec = new Vector3(camHorizontal, camVertical, 0);

        float horizontal = ControllerSystem.GetAxis(ControllerSystem.Axis.Stick_L_X);
        float vertical   = ControllerSystem.GetAxis(ControllerSystem.Axis.Stick_L_Y);

        if (mainCamera)
        {
            if (Input.GetMouseButton(0))
            {
                Ray        ray = mainCamera.ScreenPointToRay(Input.mousePosition);
                RaycastHit hitInfo;
                if (Physics.Raycast(ray, out hitInfo, 1000, groundLayer.value))
                {
                    SetFollowPosition(hitInfo.point);
                }
            }
            else
            {
                if (Mathf.Abs(horizontal) > 0.1f || Mathf.Abs(vertical) > 0.1f)
                {
                    Vector3 pos     = transform.position;
                    Vector3 faceDir = (horizontal * mainCamera.transform.right + vertical * mainCamera.transform.forward).normalized;
                    faceDir.y = 0;
                    SetFollowPosition(pos + faceDir.normalized);
                }
            }
        }

        if (followDummy)
        {
            if ((followDummy.transform.position - transform.position).magnitude < 0.02f)
            {
                Destroy(followDummy);
            }
            else
            {
                targetVec = followDummy.transform.position - transform.position;
                targetObj = followDummy;
            }
        }
    }
Exemplo n.º 3
0
    private void Awake()
    {
        entities        = new List <Entity>();
        newEntities     = new Queue <Entity>();
        expiredEntities = new Queue <Entity>();

        entitySystem     = new EntitySystem(this);
        inputSystem      = new InputSystem(this);
        moveSystem       = new MoveSystem(this);
        controllerSystem = new ControllerSystem(this);
        gunSystem        = new GunSystem(this);
        bulletSystem     = new BulletSystem(this);
        buffSystem       = new BuffSystem(this);
        aiSystem         = new AISystem(this);
        levelSystem      = new LevelSystem(this);
    }
Exemplo n.º 4
0
    void Update()
    {
        if (soldier)
        {
            if ((lastActionTime + 5) < Time.realtimeSinceStartup)
            {
                lastActionTime = Time.realtimeSinceStartup;
                ControllerSystem cs = soldier.GetComponentInChildren <ControllerSystem>();
                cs.DoAction(cs.ActionAttack.name);


                Vector3 v = transform.position;
                v.y = 1.0f;
                Instantiate(gos[1], v, transform.rotation);
            }
        }
    }
Exemplo n.º 5
0
 private void Awake()
 {
     // controller should be init here so UI manager can find controller.
     controller = transform.parent.GetComponent <ControllerSystem>();
 }