Пример #1
0
    void Update()
    {
        //pauseMovement = false;

        if (waiting && Time.time - waitTimeStart > chosenWaitTime)
        {
            waiting = false;
            if (isServer)
            {
                Cmd_SetTarget(roomCollection.GetRandomPositionInRoom());
            }
        }
        if ((interestVector - transform.position).magnitude > 0.01f ||
            (interestVector - transform.position).magnitude < -0.01f)
        {
            Quaternion targetRotation = Quaternion.LookRotation(interestVector - transform.position);
            transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);
        }

        if (ghostTarget != null)
        {
            if (Physics.Linecast(transform.position, ghostTarget.position))
            {
                if (!isServer)
                {
                    Rpc_LosePlayer();
                }
            }
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        roomCollection = FindObjectOfType <RoomCollection>() as RoomCollection;
        GameManager.instance.RegisterEnemyToRadarHelper(this);
        if (!animator)
        {
            animator = GetComponentInChildren <Animator>();
        }
        currentHealth = maxHealth;
        Frustum frustum = GetComponent <Frustum>();

        //m_networkFrustum = frustum.gameObject;
        //TODO: maybe change to add isServer?
        //if (isServer) {
        //m_networkFrustum = Instantiate (frustumPrefab, transform.GetChild (0).position, transform.GetChild (0).rotation) as GameObject;

        //NetworkServer.Spawn (m_networkFrustum);
        //m_networkFrustum.transform.parent = transform.GetChild(0).transform;
        frustum.PostStart();
        //}
        damageTextPool = GetComponent <ObjectPool>();
        charge         = GetComponent <GhostCharge>();
        if (isServer)
        {
            Rpc_SetTarget(roomCollection.GetRandomPositionInRoom());
        }
    }
Пример #3
0
 void Teleport()
 {
     transform.position           = roomCollection.GetRandomPositionInRoom();
     transform.localScale         = scale;
     isTeleporting                = false;
     ghostBehaviour.pauseMovement = false;
     animator.SetBool("Scared", false);
 }