示例#1
0
 void Start()
 {
     audioSourceComponent = GetComponent <AudioSource>();
     animatorComponent    = GetComponent <Animator>();
     dissolveScript       = GetComponent <DissolveScript>();
     currState            = State.idle;
     StartCoroutine(ShootProjectileCoroutine());
 }
示例#2
0
 void Start()
 {
     rotationAngle = new Vector3(Random.Range(0, 10), Random.Range(0, 10), Random.Range(0, 10));
     GetComponent <Rigidbody>().drag = Random.Range(0.5f, 0.1f);
     rotationSpeed = Random.Range(1, 5);
     if (useSpawnPoint)
     {
         dissolve = GetComponent <DissolveScript>();
     }
 }
示例#3
0
 void Start()
 {
     isRage            = false;
     moving            = true;
     playerPosition    = GameObject.Find("GlobalManager").GetComponent <GlobalManager>().GetPlayerPosition();
     animatorComponent = GetComponentInParent <Animator>();
     dissolveScript    = GetComponent <DissolveScript>();
     currState         = State.Run;
     animatorComponent.SetBool("Walk", true);
     UpdatebuyerCentrePoint();
 }
示例#4
0
 private void Start()
 {
     dissolve = GetComponent <DissolveScript>();
 }
示例#5
0
    // Returns whether the dimension changed or not
    public bool ChangeDimension(Constants.Color color, bool forcefield = false)
    {
        if (LevelManager.Instance().isLevelComplete)
        {
            return(false);
        }

        Constants.Color oldDimension = currentDimension;

        List <GameObject> objects = LevelManager.Instance().GetLevelObjects();

        foreach (GameObject obj in objects)
        {
            if (obj.tag == "DestroyOnLoad")
            {
                obj.GetComponent <MeshRenderer>().enabled = true;
            }
        }

        switch (color)
        {
        case Constants.Color.None:
            foreach (GameObject obj in objects)
            {
                if (obj.tag == "DestroyOnLoad")
                {
                    obj.GetComponent <MeshRenderer>().enabled = false;
                }
            }
            layers = new string[] { "Default", "Ground" };

            break;

        case Constants.Color.White:
        {
            layers = new string[] { "Default", "Ground" };
            break;
        }

        case Constants.Color.Red:
        case Constants.Color.Blue:
        case Constants.Color.Green:
        {
            layers = new string[] { "Default", "Ground", "White", color.ToString() };
            break;
        }

        default:
        {
            break;
        }
        }

        PlayerMovement.Instance().groundMask = LayerMask.GetMask(layers);

        // Don't change current dimension when we are entering the forcefield
        if (color != Constants.Color.White)
        {
            currentDimension = color;
        }
        if (forcefield)
        {
            foreach (GameObject obj in objects)
            {
                Interactable interactable = obj.GetComponent <Interactable>();
                if (interactable)
                {
                    bool objectVisible = (interactable.color == Constants.Color.White || interactable.color == Constants.Color.None || interactable.color == color || color == Constants.Color.White) && color != Constants.Color.None;
                    Physics.IgnoreCollision(obj.GetComponent <Collider>(), PlayerStateManager.Instance().gameObject.GetComponent <CharacterController>(), !objectVisible);

                    DissolveScript dissolve = obj.GetComponent <DissolveScript>();
                    if (dissolve)
                    {
                        dissolve.SetDissolve(!objectVisible);
                    }
                }
            }
        }
        if (color != Constants.Color.White)
        {
            foreach (ProfileContainer container in profileContainers)
            {
                if (container.dimension == currentDimension)
                {
                    mainCamera.GetComponent <PostProcessVolume>().profile = container.profile;
                    mainCamera.GetComponent <Skybox>().material           = container.skybox;
                    break;
                }
            }
        }
        return(oldDimension != color);
    }