コード例 #1
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        StrikeController controller       = (StrikeController)target;
        SerializedObject serializedObject = new SerializedObject(controller);

        Vector3 movement     = controller.GetTransform().position;
        Vector2 center2D     = serializedObject.FindProperty("center").vector2Value;
        int     upgradeLevel = serializedObject.FindProperty("upgradeLevel").intValue;

        if (upgradeLevel >= 6)
        {
            radius = serializedObject.FindProperty("level6Range").floatValue;
        }
        else if (upgradeLevel >= 3)
        {
            radius = serializedObject.FindProperty("level3Range").floatValue;
        }
        else
        {
            radius = serializedObject.FindProperty("level1Range").floatValue;
        }

        center = new Vector3(center2D.x + movement.x, center2D.y + movement.y, movement.z);
    }
コード例 #2
0
    //public PitcherController PitcherController;

    // Use this for initialization
    void Start()
    {
        AnimationController = GetComponent <AnimationController>();
        cube             = GameObject.Find("Cube");
        StrikeController = cube.GetComponent <StrikeController>();
        AudioSource      = GameObject.Find("AudioSource");
        //PitcherController = GetComponent<PitcherController>();
    }
コード例 #3
0
    public static bool TryGetManager(out StrikeController manager)
    {
        manager = instance;
        if (instance == null)
        {
            Debug.LogError("Trying to access StrikeController when no StrikeController is in the scene");
        }

        return(instance != null);
    }
コード例 #4
0
    public void Strike()
    {
        Debug.Log("STRIKE IN EVENT CONTROLLER");
        currentStrikes++;
        StrikeController sc;

        if (StrikeController.TryGetManager(out sc))
        {
            sc.IncrementStrike();
        }
    }
コード例 #5
0
 // Start is called before the first frame update
 void Start()
 {
     cc = GetComponent <AnotherCharacterController>();
     if (strikeController == null)
     {
         strikeController = transform.GetChild(0).GetComponent <StrikeController>();
     }
     if (strikeController == null)
     {
         strikeController = gameObject.GetChild("StrikeCollider").GetComponent <StrikeController>();
     }
     sca = GetComponent <SpineCharacterAnimator>();
 }
コード例 #6
0
    //public Rigidbody UseGravity;
    // Use this for initialization
    void Start()
    {
        Rabbit1              = GameObject.Find("Rabbit1");
        Rabbit2              = GameObject.Find("Rabbit2");
        Rabbit3              = GameObject.Find("Rabbit3");
        Rabbit4              = GameObject.Find("Rabbit4");
        Rabbit5              = GameObject.Find("Rabbit5");
        Rabbit6              = GameObject.Find("Rabbit6");
        Rabbit7              = GameObject.Find("Rabbit7");
        Rabbit8              = GameObject.Find("Rabbit8");
        Rabbit9              = GameObject.Find("Rabbit9");
        AudioSource          = GameObject.Find("AudioSource");
        FlyingDistance       = GameObject.Find("FlyingDistance");
        Fireworks1           = GameObject.Find("Fireworks1");
        Fireworks2           = GameObject.Find("Fireworks2");
        Fireworks3           = GameObject.Find("Fireworks3");
        Fireworks4           = GameObject.Find("Fireworks4");
        Fireworks5           = GameObject.Find("Fireworks5");
        Fireworks6           = GameObject.Find("Fireworks6");
        Fireworks7           = GameObject.Find("Fireworks7");
        Kim                  = GameObject.Find("Kim");
        particleSystem       = GetComponent <ParticleSystem>();
        BallCameraController = GetComponent <BallCameraController>();
        MainCamera           = GameObject.Find("Main Camera").GetComponent <Camera>();
        CenterCamera         = GameObject.Find("Center Camera").GetComponent <Camera>();
        LeftCamera           = GameObject.Find("Left Camera").GetComponent <Camera>();
        RightCamera          = GameObject.Find("Right Camera").GetComponent <Camera>();
        BallCamera           = GameObject.Find("Ball Camera").GetComponent <Camera>();
        MainCamera.enabled   = true;
        CenterCamera.enabled = false;
        LeftCamera.enabled   = false;
        RightCamera.enabled  = false;
        BallCamera.enabled   = false;
        AnimationController  = GetComponent <AnimationController>();
        Ball                 = GetComponent <Rigidbody>();
        Ball.useGravity      = false;
        StrikeController     = GetComponent <StrikeController>();
        Cube                 = GameObject.Find("Cube");
        catcherPos           = new Vector3(Cube.transform.position.x, Cube.transform.position.y, 0) + new Vector3(Random.Range(-1.5f, 2.5f), Random.Range(-1.5f, 1.5f), 0);
        ballPos              = new Vector3(this.Ball.transform.position.x, this.Ball.transform.position.y, -this.Ball.transform.position.z);
        strikeZone           = catcherPos - ballPos;
        power                = 40.0f;
        BallCameraPosition   = new Vector3(BallCamera.transform.position.x, BallCamera.transform.position.y, BallCamera.transform.position.z);
        ballPosition         = transform.position;
        diffrence            = ballPosition - this.transform.position;

        //Homerun1 = new Vector3(-3.0f, 217.0f, -364.0f);
        //Homerun1Pos = Homerun1 - ballPos;
    }
コード例 #7
0
 static void DrawGizmos(StrikeController scr, GizmoType gizmoType)
 {
     Gizmos.color = Color.cyan;
     Gizmos.DrawWireSphere(center, radius);
 }
コード例 #8
0
 private void Awake()
 {
     instance = this;
 }
コード例 #9
0
ファイル: Bomb.cs プロジェクト: CriptHunter/progetto_OGD
 void Start()
 {
     collider         = transform.GetChild(0).GetComponent <CircleCollider2D>();
     strikeController = transform.GetComponentInChildren <StrikeController>();
     StartCoroutine(ExplosionCountdown(explosionCountdown));
 }