コード例 #1
0
    private void UpdateTarget(bool manual)
    {
        // TODO: What if target is intentionally null?
        if (parentUnit.isServer)
        {
            if (parentUnit.printInfo)
            {
                if (multManager == null)
                {
                    Debug.LogError("lost multmanager 2");
                }
                Debug.Log("RUN COMMAND ");
            }
            if (multManager != null)
            {
                multManager.CmdSyncTarget(parentUnit.GetComponent <NetworkIdentity>(), turretId, target.GetGameObject().GetComponent <NetworkIdentity>(), manual);
            }
        }
        resetRotFrame = Time.frameCount;

        if (target.GetGameObject() == parentUnit.GetGameObject())
        {
            Debug.Log("Reset target");
            manual = false;
            target = null;
        }
        hasManualTarget = manual;
        //Debug.Log("Turret aiming at " + (!IsNull(target) ? target.GetTargetType().ToString() : "null"));
    }